[GRASS-user] Import postgis vector form schema

Moritz Lennert mlennert at club.worldonline.be
Thu Feb 9 09:10:51 EST 2012


On 09/02/12 13:00, Martin Landa wrote:
> Hi,
>
> 2012/2/9 matteo poletti<pollo1_91 at yahoo.it>:
>> In the manual page http://grass.fbk.eu/gdp/html_grass64/v.in.ogr.html,
>> section "Support of database schema", there is an example in which is used
>> <./>.
>
> this example seems very weird to me. From user POV I would assume
>
> db.connect driver=pg database=test schema=user1 group=group1
> db.login driver=pg database=test user=user1 password=pwd1
> v.in.ogr dsn=*PG:dbname=test* layer=river output=river     # ->  table
> user1.river
> db.select table=user1.river
>
> `./` means that OGR tries to open current directory as a data-source.

AFAICT, the example of the man page is about importing a shapefile 
'river' into GRASS using a PostgreSQL database backend, not about 
importing a PostGIS layer from PostgreSQL into GRASS. I agree that this 
is not very clear, though.

AFAIK db.connect and db.login do not make any difference for importing 
data from PostGIS.

In order to import data from a PostGIS database into GRASS using 
schemas, you have to use the active_schema parameter in the connection 
string, i.e. (using the PostGIS import example from the v.in.ogr man page):

v.in.ogr dsn="PG:host=localhost dbname=postgis user=postgres 
active_schema=myschema" layer=polymap output=polygons type=boundary,centroid

See [1] for more info.

Moritz

[1] http://www.gdal.org/ogr/drv_pg_advanced.html


More information about the grass-user mailing list