[GRASS-user] multiple polygons with same cat

Moritz Lennert mlennert at club.worldonline.be
Tue Nov 26 02:08:13 PST 2013


On 26/11/13 03:39, Dave Roberts wrote:
> 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?

Doesn't v.in.ogr attribute new, unique cat values to every polygon ?

Could you give us the exact command for importing the shapefile ?

Moritz


More information about the grass-user mailing list