[GRASS-user] Query: number of 'areas' reported in v.build output does not necessarily represent different geographical areas

Nikos Alexandris nik at nikosalexandris.net
Thu May 9 06:06:19 PDT 2013


Vincent Bainwrote:

> >> > Thank you Markus, good news !
> >> > how long has it been implemented ?

Markus Metz wrote:

> >> The option to snap boundary vertices has been there ever since. The
> >> suggestion of a reasonable (assuming floating point rounding errors)
> >> threshold for snapping has been added 3 weeks ago, on April 19th.

> >> BTW, if the input polygons are supposed to not overlap each other, the
> >> number of centroids should be identical to the number of input
> >> polygons (needs to be added to the manual).

Nikos Alexandris:

> > I tried to import USGS' (2011) Global Mangroves map:
> > 
> > # stuff copied from the map's *latest* history
> > v.in.ogr dsn="/geo/geodata/mangroves/usgs_mangroves/usgs_mangroves2.shp"
> > output="global_mangroves_usgs_2011" min_area=0.0001 snap=0.000000000000001
> > 
> > 2018421 input polygons
> > Total area: 1.47005E+11 (2750605 areas)
> > Overlapping area: 5.32085E+09 (41540 areas)
> > Area without category: 9.25489E+09 (773734 areas)

> > Twice the "error" message was like (even after I, by mistake, imported
> > with snap=1e-15):

> > Ended with an "error while impoting, try to import with snap 1e-14"
> > This means that there are still errors in the map, right?

Markus Metz wrote:

> I assume the global mangroves map should not have overlapping
> polygons, therefore as long as there are overlapping areas and/or the
> number of centroids is not equal to the number of input polygons, more
> cleaning is needed.

Unfortunately it seems there are overlapping polygons. All import attempts so 
far report many overlapping polygons, e.g.:

- snap 1e-15 (number of overlapping areas shown above)
centroids=1976871
areas=2750605

- snap 1e-8: "WARNING: 41540 areas represent more (overlapping) features..."
Number of centroids: 1976871
Number of areas: 2750605

- snap 1e-7: "WARNING: 41539 areas represent more (overlapping) features..."
Number of centroids: 1976845
Number of areas: 2750579

- snap 1e-6: "WARNING: 41538 areas represent more (overlapping) features..."
Number of centroids: 1976634
Number of areas: 2750368

Complete v.in.ogr's outputs copy-pasted below. The number of imported areas 
drops with snap=1e-7 and after. And it takes quite some time in my machine to 
import this data set.  If it is the case of so many overlapping polygons, 
maybe USGS folks should be notified?

I will search the respective documentation tonight to find stuff related to 
minimum area extent -- maybe this can help (?).

Thanks, Nikos
---

# snap=1e-8
v.in.ogr 
dsn="/geo/geodata/mangroves/global_mangroves_usgs_2011/usgs_mangroves2.shp" 
output="global_mangroves_usgs_2011_08" min_area=0.0001 snap=0.00000001
Counting polygons for 1432891 features (OGR layer <usgs_mangroves2>)...
 100%
Importing 1432891 features (OGR layer <usgs_mangroves2>)...
 100%
-----------------------------------------------------
Building topology for vector map
<global_mangroves_usgs_2011_08_tmp at PERMANENT>...
Registering primitives...
2505416 primitives registered
41179836 vertices registered
Number of nodes: 2384470
Number of primitives: 2505416
Number of points: 0
Number of lines: 0
Number of boundaries: 2505416
Number of centroids: 0
Number of areas: -
Number of isles: -
-----------------------------------------------------
Cleaning polygons
-----------------------------------------------------
Snapping boundaries (threshold = 1.000e-08)...
Reading features...
Snap vertices Pass 1: select points
 100%
Snap vertices Pass 2: assign anchor vertices
 100%
Snap vertices Pass 3: snap to assigned points
 100%
-----------------------------------------------------
Breaking polygons...
Breaking polygons (pass 1: select break points)...
 100%
Breaking polygons (pass 2: break at selected points)...
 100%
-----------------------------------------------------
Removing duplicates...
 100%
-----------------------------------------------------
Breaking boundaries...
 100%
-----------------------------------------------------
Removing duplicates...
 100%
-----------------------------------------------------
Cleaning boundaries at nodes...
 100%
-----------------------------------------------------
Merging boundaries...
 100%
-----------------------------------------------------
Removing dangles...
 100%
-----------------------------------------------------
Building topology for vector map
<global_mangroves_usgs_2011_08_tmp at PERMANENT>...
Building areas...
 100%
2750605 areas built
1278400 isles built
Number of nodes: 3463039
Number of primitives: 10456763
Number of points: 0
Number of lines: 0
Number of boundaries: 10456763
Number of centroids: 0
Number of areas: 2750605
Number of isles: 1278400
-----------------------------------------------------
Removing bridges...
 100%
-----------------------------------------------------
Building topology for vector map
<global_mangroves_usgs_2011_08_tmp at PERMANENT>...
Registering primitives...
4133856 primitives registered
39140701 vertices registered
Building areas...
 100%
2750605 areas built
1278400 isles built
Attaching islands...
 100%
Number of nodes: 2661651
Number of primitives: 4133856
Number of points: 0
Number of lines: 0
Number of boundaries: 4133856
Number of centroids: 0
Number of areas: 2750605
Number of isles: 1278400
-----------------------------------------------------
Finding centroids for OGR layer <usgs_mangroves2>...
 100%
-----------------------------------------------------
Writing centroids...
 100%
WARNING: 41540 areas represent more (overlapping) features, because
         polygons overlap in input layer(s). Such areas are linked to more
         than 1 row in attribute table. The number of features for those
         areas is stored as category in layer 2
-----------------------------------------------------
2018421 input polygons
Total area: 1.47005E+11 (2750605 areas)
Overlapping area: 5.32085E+09 (41540 areas)
Area without category: 9.25489E+09 (773734 areas)
-----------------------------------------------------
Copying features...
 100%
Building topology for vector map
<global_mangroves_usgs_2011_08 at PERMANENT>...
Registering primitives...
6110727 primitives registered
41117572 vertices registered
Building areas...
 100%
2750605 areas built
1278400 isles built
Attaching islands...
 100%
Attaching centroids...
 100%
Number of nodes: 2661651
Number of primitives: 6110727
Number of points: 0
Number of lines: 0
Number of boundaries: 4133856
Number of centroids: 1976871
Number of areas: 2750605
Number of isles: 1278400
-----------------------------------------------------
WARNING: Errors were encountered during the import
Try to import again, snapping with 1e-07: 'snap=1e-07'



# snap=1e-7
v.in.ogr 
dsn="/geo/geodata/mangroves/global_mangroves_usgs_2011/usgs_mangroves2.shp" 
output="global_mangroves_usgs_2011_07" min_area=0.0001 snap=0.0000001                                             
Counting polygons for 1432891 features (OGR layer <usgs_mangroves2>)...                                            
 100%                                                                                                              
Importing 1432891 features (OGR layer <usgs_mangroves2>)...                                                        
 100%                                                                                                              
-----------------------------------------------------                                                              
Building topology for vector map                                                                                   
<global_mangroves_usgs_2011_07_tmp at PERMANENT>...                                                                   
Registering primitives...                                                                                          
2505416 primitives registered                                                                                      
41179836 vertices registered
Number of nodes: 2384470
Number of primitives: 2505416
Number of points: 0
Number of lines: 0
Number of boundaries: 2505416
Number of centroids: 0
Number of areas: -
Number of isles: -
-----------------------------------------------------
Cleaning polygons
-----------------------------------------------------
Snapping boundaries (threshold = 1.000e-07)...
Reading features...
Snap vertices Pass 1: select points
 100%
Snap vertices Pass 2: assign anchor vertices
 100%
Snap vertices Pass 3: snap to assigned points
 100%
-----------------------------------------------------
Breaking polygons...                                                                                               
Breaking polygons (pass 1: select break points)...                                                                 
 100%                                                                                                              
Breaking polygons (pass 2: break at selected points)...                                                            
 100%                                                                                                              
-----------------------------------------------------                                                              
Removing duplicates...                                                                                             
 100%                                                                                                              
-----------------------------------------------------                                                              
Breaking boundaries...                                                                                             
 100%
-----------------------------------------------------
Removing duplicates...
 100%
-----------------------------------------------------
Cleaning boundaries at nodes...
 100%
-----------------------------------------------------
Merging boundaries...
 100%
-----------------------------------------------------
Removing dangles...
 100%
-----------------------------------------------------
Building topology for vector map
<global_mangroves_usgs_2011_07_tmp at PERMANENT>...
Building areas...
 100%
2750579 areas built
1278397 isles built
Number of nodes: 3463450
Number of primitives: 10457376
Number of points: 0
Number of lines: 0
Number of boundaries: 10457376
Number of centroids: 0
Number of areas: 2750579
Number of isles: 1278397
-----------------------------------------------------
Removing bridges...
 100%
-----------------------------------------------------
Building topology for vector map
<global_mangroves_usgs_2011_07_tmp at PERMANENT>...
Registering primitives...
4133745 primitives registered
39140346 vertices registered
Building areas...
 100%
2750579 areas built
1278397 isles built
Attaching islands...
 100%
Number of nodes: 2661563
Number of primitives: 4133745
Number of points: 0
Number of lines: 0
Number of boundaries: 4133745
Number of centroids: 0
Number of areas: 2750579
Number of isles: 1278397
-----------------------------------------------------
Finding centroids for OGR layer <usgs_mangroves2>...
 100%
-----------------------------------------------------
Writing centroids...
 100%
WARNING: 41539 areas represent more (overlapping) features, because
         polygons overlap in input layer(s). Such areas are linked to more
         than 1 row in attribute table. The number of features for those
         areas is stored as category in layer 2
-----------------------------------------------------
2018421 input polygons
Total area: 1.47005E+11 (2750579 areas)
Overlapping area: 5.32085E+09 (41539 areas)
Area without category: 9.25489E+09 (773734 areas)
-----------------------------------------------------
Copying features...
 100%
Building topology for vector map
<global_mangroves_usgs_2011_07 at PERMANENT>...
Registering primitives...
6110590 primitives registered
41117191 vertices registered
Building areas...
 100%
2750579 areas built
1278397 isles built
Attaching islands...
 100%
Attaching centroids...
 100%
Number of nodes: 2661563
Number of primitives: 6110590
Number of points: 0
Number of lines: 0
Number of boundaries: 4133745
Number of centroids: 1976845
Number of areas: 2750579
Number of isles: 1278397
-----------------------------------------------------
WARNING: Errors were encountered during the import
Try to import again, snapping with 1e-06: 'snap=1e-06'



# snap=1e-6
v.in.ogr 
dsn="/geo/geodata/mangroves/global_mangroves_usgs_2011/usgs_mangroves2.shp" 
output="global_mangroves_usgs_2011_06" min_area=0.0001 snap=0.000001
Counting polygons for 1432891 features (OGR layer <usgs_mangroves2>)...
 100%
Importing 1432891 features (OGR layer <usgs_mangroves2>)...
 100%%
-----------------------------------------------------                                                                                                                                                                                   
Building topology for vector map                                                                                                                                                                                                        
<global_mangroves_usgs_2011_06_tmp at PERMANENT>...                                                                                                                                                                                        
Registering primitives...                                                                                                                                                                                                               
2505416 primitives registered                                                                                                                                                                                                           
41179836 vertices registered                                                                                                                                                                                                            
Number of nodes: 2384470                                                                                                                                                                                                                
Number of primitives: 2505416                                                                                                                                                                                                           
Number of points: 0                                                                                                                                                                                                                     
Number of lines: 0                                                                                                                                                                                                                      
Number of boundaries: 2505416
Number of centroids: 0
Number of areas: -
Number of isles: -
-----------------------------------------------------
Cleaning polygons
-----------------------------------------------------
Snapping boundaries (threshold = 1.000e-06)...
Reading features...
Snap vertices Pass 1: select points
 100%
Snap vertices Pass 2: assign anchor vertices
 100%
Snap vertices Pass 3: snap to assigned points
 100%
-----------------------------------------------------
Breaking polygons...
Breaking polygons (pass 1: select break points)...
 100%
Breaking polygons (pass 2: break at selected points)...
 100%
-----------------------------------------------------
Removing duplicates...
 100%
-----------------------------------------------------
Breaking boundaries...
 100%
-----------------------------------------------------
Removing duplicates...
 100%
-----------------------------------------------------
Cleaning boundaries at nodes...
 100%
-----------------------------------------------------
Merging boundaries...
 100%
-----------------------------------------------------
Removing dangles...
 100%
-----------------------------------------------------
Building topology for vector map
<global_mangroves_usgs_2011_06_tmp at PERMANENT>...
Building areas...
 100%
2750368 areas built
1278375 isles built
Number of nodes: 3466918
Number of primitives: 10463204
Number of points: 0
Number of lines: 0
Number of boundaries: 10463204
Number of centroids: 0
Number of areas: 2750368
Number of isles: 1278375
WARNING: Number of incorrect boundaries: 11
-----------------------------------------------------
Removing bridges...
 100%
-----------------------------------------------------
Building topology for vector map
<global_mangroves_usgs_2011_06_tmp at PERMANENT>...
Registering primitives...
4132751 primitives registered
39137038 vertices registered
Building areas...
 100%
2750368 areas built
1278377 isles built
Attaching islands...
 100%
Number of nodes: 2660760                                                                                                                                                                              
Number of primitives: 4132751                                                                                                                                                                         
Number of points: 0                                                                                                                                                                                   
Number of lines: 0                                                                                                                                                                                    
Number of boundaries: 4132751                                                                                                                                                                         
Number of centroids: 0                                                                                                                                                                                
Number of areas: 2750368                                                                                                                                                                              
Number of isles: 1278377                                                                                                                                                                              
-----------------------------------------------------                                                                                                                                                 
Finding centroids for OGR layer <usgs_mangroves2>...                                                                                                                                                  
 100%                                                                                                                                                                                                 
-----------------------------------------------------                                                                                                                                                 
Writing centroids...                                                                                                                                                                                  
 100%                                                                                                                                                                                                 
WARNING: 41538 areas represent more (overlapping) features, because                                                                                                                                   
         polygons overlap in input layer(s). Such areas are linked to more                                                                                                                            
         than 1 row in attribute table. The number of features for those                                                                                                                              
         areas is stored as category in layer 2                                                                                                                                                       
-----------------------------------------------------                                                                                                                                                 
2018421 input polygons                                                                                                                                                                                
Total area: 1.47005E+11 (2750368 areas)                                                                                                                                                               
Overlapping area: 5.32085E+09 (41538 areas)                                                                                                                                                           
Area without category: 9.25489E+09 (773734 areas)                                                                                                                                                     
-----------------------------------------------------                                                                                                                                                 
Copying features...                                                                                                                                                                                   
 100%                                                                                                                                                                                                 
Building topology for vector map                                                                                                                                                                      
<global_mangroves_usgs_2011_06 at PERMANENT>...                                                                                                                                                          
Registering primitives...                                                                                                                                                                             
6109385 primitives registered                                                                                                                                                                         
41113672 vertices registered                                                                                                                                                                          
Building areas...                                                                                                                                                                                     
 100%                                                                                                                                                                                                 
2750368 areas built
1278377 isles built
Attaching islands...
 100%
Attaching centroids...
 100%
Number of nodes: 2660760
Number of primitives: 6109385
Number of points: 0
Number of lines: 0
Number of boundaries: 4132751
Number of centroids: 1976634
Number of areas: 2750368
Number of isles: 1278377
-----------------------------------------------------
WARNING: Errors were encountered during the import
Try to import again, snapping with 1e-05: 'snap=1e-05'


More information about the grass-user mailing list