I have a few dozen points to add to a vector map and can do this most
easily using the SQL 'INSERT INTO ...' syntax directly on the postgres
table. Does GRASS automagically update the cat column, or do I do this as
part of the insert statement?
Rich
Hi Ric.
I pretty much never work with vectors any more, so I can’t verify this without doing a lot of work. I do believe hat GRASS doesn’t necessarily need a cat column to get by, though - I’m pretty sure it takes the FID column as is from shapefiles, for example. Which would lead me to think it doesn’t require a primary key. This also makes sense because GRASS vectors are stored independently of an attribute table in the traditional sense of the word, if I’ve understood things currectly. Why don’t you try it out? I’d also be interested to see if GRASS updates the cat column.
Best,
Daniel
–
B.Sc. Daniel Lee
Geschäftsführung für Forschung und Entwicklung
ISIS - International Solar Information Solutions
Vertreten durch: Daniel Lee, Nepomuk Reinhard und Nils Räder
Softwarecenter 3
35037 Marburg
Festnetz: +49 6421 379 6256
Mobil: +49 176 6127 7269
E-Mail: Lee@isi-solutions.org
Web: http://www.isi-solutions.org
On Apr 23, 2012 8:16 PM, “Rich Shepard” <rshepard@appl-ecosys.com> wrote:
I have a few dozen points to add to a vector map and can do this most
easily using the SQL ‘INSERT INTO …’ syntax directly on the postgres
table. Does GRASS automagically update the cat column, or do I do this as
part of the insert statement?
Rich
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user
Hi Rich,
From what I recall, grass does not store the vector geometries
(points) into the database. The points are stored in grass internal
format and a link to the attributes in the table is used to get the
values (cat column). So, I don't think inserting x/y coordinates in
the table via SQL 'INSERT INTO' will work. For this you should try
v.in.ascii or, if your data is in a database, you could use v.in.db.
But I don't think that just updating the attibute database will
magically create new points
Cheers
Daniel
On Mon, Apr 23, 2012 at 3:16 PM, Rich Shepard <rshepard@appl-ecosys.com> wrote:
I have a few dozen points to add to a vector map and can do this most
easily using the SQL 'INSERT INTO ...' syntax directly on the postgres
table. Does GRASS automagically update the cat column, or do I do this as
part of the insert statement?
Rich
_______________________________________________
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user
On 23/04/12 20:16, Rich Shepard wrote:
I have a few dozen points to add to a vector map and can do this most
easily using the SQL 'INSERT INTO ...' syntax directly on the postgres
table. Does GRASS automagically update the cat column, or do I do this as
part of the insert statement?
As others have already said, you have to differentiated between the insertion of the geometry (i.e. the point) and the insertion of attribute information.
For the insertion of new points into an existing map, GRASS offers different solutions:
- v.digit for manual digitalisation of points
- v.edit tool=add (using a text file or standard input with points given in GRASS ascii standard (not point !) format)
- v.in.ascii + v.patch
In terms of attributes, if your new points have the exact same attributes as the existing points, v.in.ascii + v.patch is probably the easiest: just put your points into a csv file with all attributes, use the columns= parameter of v.in.ascii to correctly define the columns so that they match the existing ones, drop the x and y columns after import with v.db.dropcol and then v.patch the newly imported points into the existing ones, using the -e flag to keep the attributes. You can also use the -a flag of v.patch to append the data into the existing map.
If you have added points with categories (e.g. through v.edit), but without an entry in the table, you can then just insert an entry with just a category number into the attribute table with v.to.db and then add the values into the other attribute columns with v.db.update. Or you can just insert everything (category value included) with a standard INSERT INTO statement.
I guess a "existing map to which data should be appended" parameter in v.in.ascii / v.in.ogr would be nice.
Moritz
On Mon, 23 Apr 2012, Daniel Victoria wrote:
From what I recall, grass does not store the vector geometries (points)
into the database. The points are stored in grass internal format and a
link to the attributes in the table is used to get the values (cat
column).
Daniel,
That's correct ... unless one is using postgis.
So, I don't think inserting x/y coordinates in the table via SQL 'INSERT
INTO' will work. For this you should try v.in.ascii or, if your data is in
a database, you could use v.in.db. But I don't think that just updating
the attibute database will magically create new points
I'll see. I did not know if grass would read the attribute table and put a
point at each easting/northing since I added cat values to the table. The
worst that could occur is that I dump the postgres table and recreate the
map as v.in.ascii.
Thanks,
Rich