[GRASSLIST:252] Re: [GRASS5] Built-in vector documentation extended

Markus Neteler neteler at itc.it
Mon Mar 20 02:55:52 EST 2006


Michael Barton wrote:

>Thomas,
>
>You must have an integer key field. I looked in the v.in.db
>documentation--generally a good idea. It says that for Postgres you can use
>the object id in the following way.
>
>2) Creating a map from PostGIS:
>To extract coordinate values from PostGIS, functions have to be used:
>
> v.in.db driver=pg database="host=myserver.itc.it,dbname=mydb,user=name" \
>         table=station x="x(geom)" y="y(geom)" z="z(geom)" key=id
>out=meteostations
>
>If an ID column is not not present in the PostgreSQL table, the 'object ID'
>of PostgreSQL can be used. In this case set:
>
>  cat=OID
>
>Otherwise you must create a key field. The key=# argument is for you to
>specify which field  in your data table will serve as the key field. You are
>putting in an integer VALUE rather than the name of a column in your table.
>  
>

Michael,

I had some troubles recently to use OID (that's why I removed this hint
from the manual
page). Maybe this is better?

ALTER TABLE mytable ADD id integer;
CREATE SEQUENCE mytabe_seq;
UPDATE mytabe SET id= nextval('mytable_seq');
SELECT * from mytable;

Markus




More information about the grass-user mailing list