Vector topology cleaning: Difference between revisions

From GRASS-Wiki
Jump to navigation Jump to search
(cleaning of vector networks (based on grass-user mailing list hints by Markus Metz))
(+Hints; page structured)
Line 1: Line 1:
'''Q:''' How can I speed up topologial cleaning ({{cmd|v.clean}}) for large network datasets (for example OpenStreetMap data)?
== Cleaning large network datasets ==


'''A:''' The improved {{cmd|v.clean|version=70}} version in GRASS 7 is way faster. Here some hints:
'''Q:''' How can I speed up topologial cleaning ({{cmd|v.clean}}) in GRASS 6 for large network datasets (for example OpenStreetMap data)?
 
'''A:''' The improved {{cmd|v.clean|version=70}} version in GRASS 7 is way faster. Here some hints though:


''GRASS 6:'' When '''breaking lines''' it is recommended to  
''GRASS 6:'' When '''breaking lines''' it is recommended to  
Line 10: Line 12:
''GRASS 7:'' Here this has become much easier. Use {{cmd|v.clean|version=70}} with the -c flag and 'tool=break' and 'type=line'. The 'rmdupl' tool is then ''automatically'' added, and the splitting and merging is done internally.
''GRASS 7:'' Here this has become much easier. Use {{cmd|v.clean|version=70}} with the -c flag and 'tool=break' and 'type=line'. The 'rmdupl' tool is then ''automatically'' added, and the splitting and merging is done internally.


----
== Cleaning patched polygons ==


'''Q:''' How can I patch to fitting area maps with have been digitized separately and correct the topology? I observe that the shared polygon boundaries do not perfectly match... I need to clean topology.
'''Q:''' How can I patch to fitting area maps with have been digitized separately and correct the topology? I observe that the shared polygon boundaries do not perfectly match... I need to clean topology.
Line 25: Line 27:
   v.in.ogr natural_earth/ne_110m_admin_0_countries.shp out=country_boundaries snap=0.0001 TODO: FIX THIS
   v.in.ogr natural_earth/ne_110m_admin_0_countries.shp out=country_boundaries snap=0.0001 TODO: FIX THIS


----
== Polygon import from SHAPE file ==


'''Q:''' How about self-intersecting lines and boundaries?
[[Image:Polygons overlapping.png|center|thumb|300px|Overlayed polygons after import from SHAPE file (Simple Features]]


'''A:''' In the GRASS topological model self-intersecting lines are allowed, self-intersecting boundaries are not. Self-intersecting lines are ok e.g. for {{cmd|v.net}} modules, e.g. to represent a bridge of a secondary road over a highway.
v.clean applied:
[[Image:Polygons overlapping cleaned.png|center|thumb|300px|Overlayed polygons topologically cleaned. Note the double categories.]]


Note: There are some modules that do not like self-intersecting lines, e.g with {{cmd|v.buffer}} problems are expected.
=== Hints ===


----
* In recent GRASS GIS versions, snapping thresholds for unclean polygons are suggested to the user when using v.in.ogr
* If the input polygons are supposed to not overlap each other, the number of centroids should be identical to the number of input polygons. If not the case, more topological cleaning is needed.


'''Polygon import from SHAPE file:'''
'''Q:''' How about self-intersecting lines and boundaries?


[[Image:Polygons overlapping.png|center|thumb|300px|Overlayed polygons after import from SHAPE file (Simple Features]]
'''A:''' In the GRASS topological model self-intersecting lines are allowed, self-intersecting boundaries are not. Self-intersecting lines are ok e.g. for {{cmd|v.net}} modules, e.g. to represent a bridge of a secondary road over a highway.


v.clean applied:
Note: There are some modules that do not like self-intersecting lines, e.g with {{cmd|v.buffer}} problems are expected.
[[Image:Polygons overlapping cleaned.png|center|thumb|300px|Overlayed polygons topologically cleaned. Note the double categories.]]


=== See also ===
== See also ==


* [[Vector topology]]
* [[Vector topology]]

Revision as of 20:45, 11 May 2013

Cleaning large network datasets

Q: How can I speed up topologial cleaning (v.clean) in GRASS 6 for large network datasets (for example OpenStreetMap data)?

A: The improved v.clean version in GRASS 7 is way faster. Here some hints though:

GRASS 6: When breaking lines it is recommended to

  • split the lines first in smaller segments with v.split using the vertices option. Then,
  • run v.clean with 'tool=break'. After that,
  • use v.build.polylines to merge lines again.

GRASS 7: Here this has become much easier. Use v.clean with the -c flag and 'tool=break' and 'type=line'. The 'rmdupl' tool is then automatically added, and the splitting and merging is done internally.

Cleaning patched polygons

Q: How can I patch to fitting area maps with have been digitized separately and correct the topology? I observe that the shared polygon boundaries do not perfectly match... I need to clean topology.

Polygon vector map with topology problems

A: You can use v.clean for this.

Tools to consider:

  • snap,bpol,rmdupl,break,rmdupl,rms
  • the threshold (in map units) should be very small

Example (Lat-Long):

 v.in.ogr natural_earth/ne_110m_admin_0_countries.shp out=country_boundaries snap=0.0001 TODO: FIX THIS

Polygon import from SHAPE file

Overlayed polygons after import from SHAPE file (Simple Features

v.clean applied:

Overlayed polygons topologically cleaned. Note the double categories.

Hints

  • In recent GRASS GIS versions, snapping thresholds for unclean polygons are suggested to the user when using v.in.ogr
  • If the input polygons are supposed to not overlap each other, the number of centroids should be identical to the number of input polygons. If not the case, more topological cleaning is needed.

Q: How about self-intersecting lines and boundaries?

A: In the GRASS topological model self-intersecting lines are allowed, self-intersecting boundaries are not. Self-intersecting lines are ok e.g. for v.net modules, e.g. to represent a bridge of a secondary road over a highway.

Note: There are some modules that do not like self-intersecting lines, e.g with v.buffer problems are expected.

See also