[GRASS-user] Syntax v.in.ogr for schema-support PostGIS

Moritz Lennert mlennert at club.worldonline.be
Wed Aug 9 07:32:09 PDT 2017


On 09/08/17 16:13, patrick s. wrote:
> Dear all
> 
> A short not on the manual v.in.ogr. It appears to be out of date for 
> PostGIS import. I have to call the schema in "layer" to have 
> schema-support. My previous code as given below was been running without 
> this.
> 

This has been fixed a few months ago both in trunk and in the 7.2 
release branch, so the new 7.2.2 release that is due pretty soon (end of 
the month) should have the fix included. However, the man pages have not 
been updated AFAICS.

You can read the thread starting at [1] for some discussion on the 
issue. The important issue is that db.connect should not be used for 
data import as this sets the database connection for all attribute 
tables of vector maps to be created, included of the one imported...

So you should be able to do everything with a single v.in.ogr call, 
without db.connect/db.login.

Moritz

[1] https://lists.osgeo.org/pipermail/grass-dev/2017-May/085032.html


> Best Regards,
> 
> patrick schirmer
> 
> 
> #Syntax in the past and still recommended according to manual:
> 
> INPATH="PG:dbname=mydatabase schema=myschema"
> 
> db.connect driver=pg database=mydatabase schema=myschema #eventially 
> unnecessary
> 
> v.in.ogr input="$INPATH" layer="mytablename" out=mygrasstablename 
> type="point" -r
> 
> 
> #Working code in version GRASS72:
> 
> INPATH="PG:dbname=$DB_NAME"
> 
> db.connect driver=pg database=mydatabase #no schema required, as it has 
> to be called inside v.in.ogr
> 
> v.in.ogr input="$INPATH"  layer="myschema.mytablename" 
> out=mygrasstablename type="point" -r
> 
> 
> #extract of manual:
> 
> db.connect driver=pg database=test schema=user1
> db.login user=user1 password=pwd1
> # -> input="PG:dbname=test user=user1 password=pwd1" layer="user1.river"
> v.in.ogr input=PG: layer=river output=river
> db.select table=user1.river
> 
> 
> 
> 
> 
> _______________________________________________
> grass-user mailing list
> grass-user at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/grass-user
> 




More information about the grass-user mailing list