Re: [GRASS-user] Problem with v.to.db after v.dissolve and v.category

2018-08-20 Thread Markus Metz
On Mon, Aug 20, 2018 at 4:11 PM, Mira Kattwinkel <
kattwinkel-m...@uni-landau.de> wrote:
>
> 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 ...
> 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

v.category deletes categories from geometries, but does not touch the
attribute table. Since you deleted all categories in layer 1, you should
also delete the attribute table linked to layer 1 with
v.db.droptable map=lakes_diss_wocat layer=1 -f
>
> 2. add category
> v.category input=lakes_diss_wocat@PERMANENT output=lakes_diss_wcat
option=add

you should specify the geometry type for which categories should be added,
here type=centroid

Alternatively, you could use with GRASS 7.5
v.extract input=lakes dissolve_column=name type=area output=lakes_diss

Markus M


> Processing features...
> Copying attribute table(s)...
> Building topology for vector map ...
> 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
___
grass-user mailing list
grass-user@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-user

[GRASS-user] Problem with v.to.db after v.dissolve and v.category

2018-08-20 Thread Mira Kattwinkel

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 ...
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 ...
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