[GRASS-user] PostGIS to GRASS

Markus Neteler neteler at itc.it
Fri Aug 18 09:43:54 EDT 2006


H.Lekin wrote on 08/18/2006 11:49 AM:
> Hi all,
>
> I want to access a shapefile loaded into PostgreSQL/PostGIS via
> shp2pgsql. v.in.db seems to be a suitable choice:
>
> GRASS 6.0.2 (Germany):~/work > v.in.db table=countryboundaries
> x="X(the_geom)" y="Y(the_geom)" key=gid out=countrybnds
> DBMI-Postgres driver error:
> Cannot select:
> select gid, X(the_geom), Y(the_geom) from countryboundaries
> ERROR:  Argument to X() must be a point
> ERROR: Cannot open select cursor: 'select gid, X(the_geom), Y(the_geom)
>        from countryboundaries'
>
> GRASS expects the column to hold point data, but 'the_geom' looks like this:
>
> gistest=> select astext (the_geom) from countryboundaries;
> ---snip---
> MULTIPOLYGON(((3.71071599999999 50.380975,...,3.71071599999999 50.380975)))
> # for point data
> ---snip---
> MULTIPOINT(4.36800044829999 50.83700218311)
>
> Do I have to select the individual points and write them into separate
> columns? Is there any other way to access such coordinates; a more
> appropriate GRASS module?
>
>   
I think that you have to use v.in.ogr.

Markus




More information about the grass-user mailing list