[GRASS-user] Exporting to PostGIS - SRID

I am trying to export line vectors to PostGIS with either v.out.ogr or v.out.postgis.

I find that v.out.ogr sets the wrong SRID in the PostGIS geometry_columns. I get SRID 900914 instead of the SRID of the GRASS Location.

Using v.out.postgis, on the other hand, I call option=“SRID=2039” and the SRID is correct in the PostGIS table, but no attributes. I tried with both without the flag ‘-t’ and with the flag. No difference.

Here are the commands:

GRASS 7.0.4 (ITM):> g.version
GRASS 7.0.4 (2016)
GRASS 7.0.4 (ITM):> g.proj -p
-PROJ_INFO-------------------------------------------------
name : Transverse Mercator
proj : tmerc
ellps : grs80
lat_0 : 31.73439361111111
lon_0 : 35.20451694444445
k : 1.0000067
x_0 : 219529.584
y_0 : 626907.39
towgs84 : -48,55,52,0,0,0,0
no_defs : defined
-PROJ_UNITS------------------------------------------------
unit : metre
units : metres
meters : 1

GRASS 7.0.4 (ITM):> v.out.postgis -c --overwrite input=${STREAMS} type=line output="PG:host=nekarot dbname=geodata user=geodba" output_layer=nikuz.${STREAMS} options="SRID=2039,GEOMETRY_NAME=geom,FID=gid"
# I get correct SRID, but no attributes ??

GRASS 7.0.4 (ITM):> v.out.ogr -s --overwrite input=${STREAMS} format=PostgreSQL type=line output="PG:host=nekarot dbname=geodata user=geodba" lco="FID=gid,GEOMETRY_NAME=geom" output_layer=nikuz.${STREAMS}
# Full set of attributes b``ut SRID=900914 ??

Any help is appreciated,
Micha

···
-- 
Micha Silver
Arava Drainage Authority
+972-523-665918

Hi,

2016-06-07 11:05 GMT+02:00 Micha Silver <micha@arava.co.il>:

GRASS 7.0.4 (ITM):> g.proj -p
-PROJ_INFO-------------------------------------------------
name : Transverse Mercator
proj : tmerc
ellps : grs80
lat_0 : 31.73439361111111
lon_0 : 35.20451694444445
k : 1.0000067
x_0 : 219529.584
y_0 : 626907.39
towgs84 : -48,55,52,0,0,0,0
no_defs : defined
-PROJ_UNITS------------------------------------------------
unit : metre
units : metres
meters : 1

the EPSG code seems to be missing in your location definition. Please
try to update your settings by running `g.proj -c epsg=`. Then also
make sure that the EPSG code is defined in spatial_ref_sys. It should
work (tested v.out.ogr in 7.0.5svn). Martin

--
Martin Landa
http://geo.fsv.cvut.cz/gwiki/Landa
http://gismentors.cz/mentors/landa

Hi,

2016-06-07 11:05 GMT+02:00 Micha Silver <micha@arava.co.il>:

GRASS 7.0.4 (ITM):> v.out.postgis -c --overwrite input=${STREAMS} type=line
output="PG:host=nekarot dbname=geodata user=geodba"
output_layer=nikuz.${STREAMS} options="SRID=2039,GEOMETRY_NAME=geom,FID=gid"
# I get correct SRID, but no attributes ??

I cannot reproduce this issue (no attributes) in 7.0.5svn. Moreover
there is no -c flag in v.out.postgis... (?)

Ma

--
Martin Landa
http://geo.fsv.cvut.cz/gwiki/Landa
http://gismentors.cz/mentors/landa

That did it, Thanks !
(I Wonder where the Google Mercator 900914 came from??)

I’ll continue checking my v.out.postgis problem.

Best,
Micha

···

On 06/07/2016 12:33 PM, Martin Landa wrote:

------ Original Message ------ Subject: Re: [GRASS-user] Exporting to PostGIS - SRID Date: Tue, 7 Jun 2016 11:33:17 +0200 To: Micha Silver, Grass Users List From: Martin Landa

Hi,

2016-06-07 11:05 GMT+02:00 Micha Silver [<micha@arava.co.il>](mailto:micha@arava.co.il):

GRASS 7.0.4 (ITM):> g.proj -p
-PROJ_INFO-------------------------------------------------
name       : Transverse Mercator
proj       : tmerc
ellps      : grs80
lat_0      : 31.73439361111111
lon_0      : 35.20451694444445
k          : 1.0000067
x_0        : 219529.584
y_0        : 626907.39
towgs84    : -48,55,52,0,0,0,0
no_defs    : defined
-PROJ_UNITS------------------------------------------------
unit       : metre
units      : metres
meters     : 1

the EPSG code seems to be missing in your location definition. Please
try to update your settings by running `g.proj -c epsg=`. Then also
make sure that the EPSG code is defined in spatial_ref_sys. It should
work (tested v.out.ogr in 7.0.5svn). Martin

Micha Silver
Arava Drainage Authority
+972-523-665918

Hi,

2016-06-07 14:42 GMT+02:00 Micha Silver <micha@arava.co.il>:

That did it, Thanks !
(I Wonder where the Google Mercator 900914 came from??)

if srs is not found a new one is just added to spatial_ref_sys, the
max id is usually 900913 (this code was in the past used for EPSG:3587
- Web Mercator). So the next id is than 900914. Martin

--
Martin Landa
http://geo.fsv.cvut.cz/gwiki/Landa
http://gismentors.cz/mentors/landa