[GRASS-user] PostgreSQL append

Good day all,

1.
I have a vector grass file and I want to append it's data to a
PostgreSQL table, atm I use the following command:

v.out.ogr input=flood_vect type=area 'dsn=PG:host=localhost
dbname=gisdb user=gis password=*' olayer=flood layer=1
format=PostgreSQL lco='OVERWRITE=YES'

This command overwrites the postgis table, I want to append the data.
If I remove the lco='OVERWRITE=YES' I just get and error that the
table already exists.

2. When I export vector data to a PostgreSQL table it sets the wrong SRID

g.region -p

projection: 3 (Latitude-Longitude)
zone: 0
datum: wgs84
ellipsoid: wgs84
north: 47:04:48.37738N
south: 46:55:11.265564N
west: 28:44:44.481812E
east: 28:58:20.944519E
nsres: 0:00:02.885559
ewres: 0:00:02.885027
rows: 200
cols: 283
cells: 56600

the SRID of the geometry is 900917, I expect it to be 4326 (wgs84)
what am I doing wrong ?

--
http://iap.md, The future is open

On Sun, Aug 2, 2009 at 9:43 PM, Pavel Iacovlev<iacovlev.pavel@gmail.com> wrote:

Good day all,

1.
I have a vector grass file and I want to append it's data to a
PostgreSQL table, atm I use the following command:

v.out.ogr input=flood_vect type=area 'dsn=PG:host=localhost
dbname=gisdb user=gis password=*' olayer=flood layer=1
format=PostgreSQL lco='OVERWRITE=YES'

This command overwrites the postgis table, I want to append the data.
If I remove the lco='OVERWRITE=YES' I just get and error that the
table already exists.

The OGR tools support is:
ogr2ogr -update -append ..

but I am afraid that v.out.ogr does currently not.

2. When I export vector data to a PostgreSQL table it sets the wrong SRID

g.region -p

projection: 3 (Latitude-Longitude)
zone: 0
datum: wgs84
ellipsoid: wgs84
north: 47:04:48.37738N
south: 46:55:11.265564N
west: 28:44:44.481812E
east: 28:58:20.944519E
nsres: 0:00:02.885559
ewres: 0:00:02.885027
rows: 200
cols: 283
cells: 56600

the SRID of the geometry is 900917,

Do you mean 900913 (the unofficial outdated Google Mercator EPSG code)
?

I expect it to be 4326 (wgs84) what am I doing wrong ?

It should be like that. I currently have no PostGIS installed for
a test. Maybe someone else in this list...

Markus

I am very new to grass so I am not sure if it's a bug or not, maybe I
defined my "location" incorrectly, how do I check ?

select * from geometry_columns where f_table_name = 'flood'

f_table_catalog f_table_schema f_table_name f_geometry_column
coord_dimension srid type
       public flood wkb_geometry 2 900917 POLYGON

On Sun, Aug 2, 2009 at 11:25 PM, Markus Neteler<neteler@osgeo.org> wrote:

On Sun, Aug 2, 2009 at 9:43 PM, Pavel Iacovlev<iacovlev.pavel@gmail.com> wrote:

Good day all,

1.
I have a vector grass file and I want to append it's data to a
PostgreSQL table, atm I use the following command:

v.out.ogr input=flood_vect type=area 'dsn=PG:host=localhost
dbname=gisdb user=gis password=*' olayer=flood layer=1
format=PostgreSQL lco='OVERWRITE=YES'

This command overwrites the postgis table, I want to append the data.
If I remove the lco='OVERWRITE=YES' I just get and error that the
table already exists.

The OGR tools support is:
ogr2ogr -update -append ..

but I am afraid that v.out.ogr does currently not.

2. When I export vector data to a PostgreSQL table it sets the wrong SRID

g.region -p

projection: 3 (Latitude-Longitude)
zone: 0
datum: wgs84
ellipsoid: wgs84
north: 47:04:48.37738N
south: 46:55:11.265564N
west: 28:44:44.481812E
east: 28:58:20.944519E
nsres: 0:00:02.885559
ewres: 0:00:02.885027
rows: 200
cols: 283
cells: 56600

the SRID of the geometry is 900917,

Do you mean 900913 (the unofficial outdated Google Mercator EPSG code)
?

I expect it to be 4326 (wgs84) what am I doing wrong ?

It should be like that. I currently have no PostGIS installed for
a test. Maybe someone else in this list...

Markus

--
http://iap.md, The future is open

On Sun, Aug 2, 2009 at 11:35 PM, Pavel Iacovlev<iacovlev.pavel@gmail.com> wrote:

I am very new to grass so I am not sure if it's a bug or not, maybe I
defined my "location" incorrectly, how do I check ?

select * from geometry_columns where f_table_name = 'flood'

f_table_catalog f_table_schema f_table_name f_geometry_column
coord_dimension srid type
public flood wkb_geometry 2 900917 POLYGON

Two ideas:

- run to obtain the projection of the location as WKT output:
  g.proj -w

- export to SHAPE file first and see if the .prj file is ok (LatLong in
   your case).

If both is fine, then would I suspect some problem with the PostGIS
export.

Markus

g.proj -w

GEOGCS["wgs84",
    DATUM["WGS_1984",
        SPHEROID["wgs84",6378137,298.257223563],
        TOWGS84[0.000,0.000,0.000]],
    PRIMEM["Greenwich",0],
    UNIT["degree",0.0174532925199433]]

shape .prj file:
GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["wgs84",6378137,298.257223563]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]]

On Mon, Aug 3, 2009 at 12:46 AM, Markus Neteler<neteler@osgeo.org> wrote:

On Sun, Aug 2, 2009 at 11:35 PM, Pavel Iacovlev<iacovlev.pavel@gmail.com> wrote:

I am very new to grass so I am not sure if it's a bug or not, maybe I
defined my "location" incorrectly, how do I check ?

select * from geometry_columns where f_table_name = 'flood'

f_table_catalog f_table_schema f_table_name f_geometry_column
coord_dimension srid type
public flood wkb_geometry 2 900917 POLYGON

Two ideas:

- run to obtain the projection of the location as WKT output:
g.proj -w

- export to SHAPE file first and see if the .prj file is ok (LatLong in
your case).

If both is fine, then would I suspect some problem with the PostGIS
export.

Markus

--
http://iap.md, The future is open