[GRASS-user] multiple polygons with same cat
Dave Roberts
dvrbts at ecology.msu.montana.edu
Mon Nov 25 18:39:05 PST 2013
Friends,
I'm not exactly a newbie, but still yet quite naive in GRASS. This
seems like a simple problem, but I suspect unforeseen problems with the
simple solution.
I have imported a surficial geology map from a shapefile. There are
1082 polygons. Each of the polygons with the same surficial geology
(e.g Agn, Archean gneiss) has the same cat (i.e. there are 29 polygons
with cat=3). I would like to add several columns to this table (e.g.
geologic era and primary lithology (e.g. granite vs limestone)).
I normally associate all vector maps with a table in PostgreSQL
using cat as the primary key (i.e. v.db.connect -o key=cat), but that
clearly won't work here. I could rename the column 'cat' in the DBF
file, and add a new column with values 1-1082 as cat. If I save that as
a new DBF file in a new shapefile directory, when I re-import with
v.in.ogr will it necessarily get it right? I.e, will GRASS associate
the vertices the first polygon in the shapefile with the first row in
the DBF file? I only ask because PostgreSQl (like most DBMSs) does not
guarantee the records to be in any specific order, and perhaps
shapefiles don't either?
Is there a simple way to renumber the polygons 1 through 1082 that
maintains integrity and allows me to connect the vector coverage to
PostgreSQL instead of DBF?
Thanks, Dave
--
More information about the grass-user
mailing list