Dear list,

I dissolve a vector map of lakes based on the names of the features (v.dissolve). As many of the features do not have names, I get, among the others, one new feature built up by many parts.

v.dissolve input=lakes@PERMANENT column=name output=lakes_diss
I do get a warning during the dissolve:
...
WARNING: Number of centroids exceeds number of areas: 44345 > 43502
WARNING: Number of duplicate centroids: 1237

This results in 932 features with one containing the majority of lakes (those without a name). Then, I want to calculate the area (v.to.db) but this gives a wrong result because I need the area of every single lake.

This is the same problem as described here https://lists.osgeo.org/pipermail/grass-user/2011-January/059282.html and I followed the advice given by Markus. However, I still get one big feature without a name and get error messages when calculating the area. Can anybody please give me an hint what's going wrong?

Here are the steps:
1. delete categories:

v.category input=lakes_diss@PERMANENT output=lakes_diss_wocat option=del cat=-1
Processing features...
Copying attribute table(s)...
Building topology for vector map <lakes_diss_wocat@PERMANENT>...
Registering primitives...
88399 primitives registered
1409269 vertices registered
Building areas...
43502 areas built
43426 isles built
Attaching islands...
Attaching centroids...
Number of nodes: 45215
Number of primitives: 88399
Number of points: 0
Number of lines: 0
Number of boundaries: 45291
Number of centroids: 43108
Number of areas: 43502
Number of isles: 43426
v.category complete. 43108 features modified.
(Mon Aug 20 15:59:30 2018) Command finished (3 sec)
--> still 932 features in attribute table

2. add category
v.category input=lakes_diss_wocat@PERMANENT output=lakes_diss_wcat option=add
Processing features...
Copying attribute table(s)...
Building topology for vector map <lakes_diss_wcat@PERMANENT>...
Registering primitives...
88399 primitives registered
1409269 vertices registered
Building areas...
43502 areas built
43426 isles built
Attaching islands...
Attaching centroids...
Number of nodes: 45215
Number of primitives: 88399
Number of points: 0
Number of lines: 0
Number of boundaries: 45291
Number of centroids: 43108
Number of areas: 43502
Number of isles: 43426
v.category complete. 43108 features modified.
(Mon Aug 20 16:02:07 2018) Command finished (3 sec)
--> 932 features in attribute table

3. add new column and populate with area

v.db.addcolumn map=lakes_diss_wcat@PERMANENT columns=area double

v.to.db map=lakes_diss_wcat@PERMANENT option=area columns=area
Reading areas...
Updating database...
WARNING: Record (cat 933) does not exist (not updated)
[a long long list...]
43108 categories read from vector map (layer 1)
932 records selected from table (layer 1)
932 categories read from vector map exist in selection from table
42176 categories read from vector map don't exist in selection from table
932 records updated/inserted (layer 1)

Thanks a lot,
Mira

_______________________________________________
grass-user mailing list
grass-user@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-user

Reply via email to