Automatically repairing polygons and planar partitions ... · very slow for big polygons 12/22...
Transcript of Automatically repairing polygons and planar partitions ... · very slow for big polygons 12/22...
![Page 1: Automatically repairing polygons and planar partitions ... · very slow for big polygons 12/22 \Visual repair" GRASS ArcGIS 13/22. Our solution = constrained triangulation (CT) 1](https://reader033.fdocuments.us/reader033/viewer/2022050302/5f6b2e6f61c9732f35109587/html5/thumbnails/1.jpg)
Automatically repairing polygons and planarpartitions with prepair and pprepair
Ken Arroyo Ohori Hugo Ledoux Martijn Meijers
OSGIS 2012September 5, 2012
1 / 22
![Page 2: Automatically repairing polygons and planar partitions ... · very slow for big polygons 12/22 \Visual repair" GRASS ArcGIS 13/22. Our solution = constrained triangulation (CT) 1](https://reader033.fdocuments.us/reader033/viewer/2022050302/5f6b2e6f61c9732f35109587/html5/thumbnails/2.jpg)
Planar partition = no gaps, no overlaps
2 / 22
![Page 3: Automatically repairing polygons and planar partitions ... · very slow for big polygons 12/22 \Visual repair" GRASS ArcGIS 13/22. Our solution = constrained triangulation (CT) 1](https://reader033.fdocuments.us/reader033/viewer/2022050302/5f6b2e6f61c9732f35109587/html5/thumbnails/3.jpg)
Real data = problems
3 / 22
![Page 4: Automatically repairing polygons and planar partitions ... · very slow for big polygons 12/22 \Visual repair" GRASS ArcGIS 13/22. Our solution = constrained triangulation (CT) 1](https://reader033.fdocuments.us/reader033/viewer/2022050302/5f6b2e6f61c9732f35109587/html5/thumbnails/4.jpg)
Real data = problems
3 / 22
![Page 5: Automatically repairing polygons and planar partitions ... · very slow for big polygons 12/22 \Visual repair" GRASS ArcGIS 13/22. Our solution = constrained triangulation (CT) 1](https://reader033.fdocuments.us/reader033/viewer/2022050302/5f6b2e6f61c9732f35109587/html5/thumbnails/5.jpg)
What about polygons?
OGC Simple Features +ISO19107:
1 no self-intersection
2 closed boundaries
3 rings can touch but notoverlap
4 no duplicate points
5 no dangling edges
6 connected interior
p2
p4 p5 p6
p7 p8 p9
p3
p12p11p10
p1
exteriorboundary
interiorboundary
4 / 22
![Page 6: Automatically repairing polygons and planar partitions ... · very slow for big polygons 12/22 \Visual repair" GRASS ArcGIS 13/22. Our solution = constrained triangulation (CT) 1](https://reader033.fdocuments.us/reader033/viewer/2022050302/5f6b2e6f61c9732f35109587/html5/thumbnails/6.jpg)
Real data = problems
5 / 22
![Page 7: Automatically repairing polygons and planar partitions ... · very slow for big polygons 12/22 \Visual repair" GRASS ArcGIS 13/22. Our solution = constrained triangulation (CT) 1](https://reader033.fdocuments.us/reader033/viewer/2022050302/5f6b2e6f61c9732f35109587/html5/thumbnails/7.jpg)
Real data = problems
5 / 22
![Page 8: Automatically repairing polygons and planar partitions ... · very slow for big polygons 12/22 \Visual repair" GRASS ArcGIS 13/22. Our solution = constrained triangulation (CT) 1](https://reader033.fdocuments.us/reader033/viewer/2022050302/5f6b2e6f61c9732f35109587/html5/thumbnails/8.jpg)
Real data = problems
5 / 22
![Page 9: Automatically repairing polygons and planar partitions ... · very slow for big polygons 12/22 \Visual repair" GRASS ArcGIS 13/22. Our solution = constrained triangulation (CT) 1](https://reader033.fdocuments.us/reader033/viewer/2022050302/5f6b2e6f61c9732f35109587/html5/thumbnails/9.jpg)
Standards/definitions tell us what is valid, but...what to do with invalid data?
Planar partitions: snapping / topology rules /manual work
Polygons: “buffer-by-0” / PostGIS 2.0’sST MakeValid() / “visual repair”
6 / 22
![Page 10: Automatically repairing polygons and planar partitions ... · very slow for big polygons 12/22 \Visual repair" GRASS ArcGIS 13/22. Our solution = constrained triangulation (CT) 1](https://reader033.fdocuments.us/reader033/viewer/2022050302/5f6b2e6f61c9732f35109587/html5/thumbnails/10.jpg)
Snapping
Tolerance (threshold) isused for snapping vertices
Tolerance based on scale ofdatasets
Works fine for simpleproblems
7 / 22
![Page 11: Automatically repairing polygons and planar partitions ... · very slow for big polygons 12/22 \Visual repair" GRASS ArcGIS 13/22. Our solution = constrained triangulation (CT) 1](https://reader033.fdocuments.us/reader033/viewer/2022050302/5f6b2e6f61c9732f35109587/html5/thumbnails/11.jpg)
Snapping
Tolerance (threshold) isused for snapping vertices
Tolerance based on scale ofdatasets
Works fine for simpleproblems
7 / 22
![Page 12: Automatically repairing polygons and planar partitions ... · very slow for big polygons 12/22 \Visual repair" GRASS ArcGIS 13/22. Our solution = constrained triangulation (CT) 1](https://reader033.fdocuments.us/reader033/viewer/2022050302/5f6b2e6f61c9732f35109587/html5/thumbnails/12.jpg)
Snapping
Tolerance (threshold) isused for snapping vertices
Tolerance based on scale ofdatasets
Works fine for simpleproblems
7 / 22
![Page 13: Automatically repairing polygons and planar partitions ... · very slow for big polygons 12/22 \Visual repair" GRASS ArcGIS 13/22. Our solution = constrained triangulation (CT) 1](https://reader033.fdocuments.us/reader033/viewer/2022050302/5f6b2e6f61c9732f35109587/html5/thumbnails/13.jpg)
Snapping
Spikes and punctures can create invalid polygons
8 / 22
![Page 14: Automatically repairing polygons and planar partitions ... · very slow for big polygons 12/22 \Visual repair" GRASS ArcGIS 13/22. Our solution = constrained triangulation (CT) 1](https://reader033.fdocuments.us/reader033/viewer/2022050302/5f6b2e6f61c9732f35109587/html5/thumbnails/14.jpg)
Snapping
Spikes and punctures can create invalid polygons
8 / 22
![Page 15: Automatically repairing polygons and planar partitions ... · very slow for big polygons 12/22 \Visual repair" GRASS ArcGIS 13/22. Our solution = constrained triangulation (CT) 1](https://reader033.fdocuments.us/reader033/viewer/2022050302/5f6b2e6f61c9732f35109587/html5/thumbnails/15.jpg)
Snapping
Splitting of polygons into several polygons
8 / 22
![Page 16: Automatically repairing polygons and planar partitions ... · very slow for big polygons 12/22 \Visual repair" GRASS ArcGIS 13/22. Our solution = constrained triangulation (CT) 1](https://reader033.fdocuments.us/reader033/viewer/2022050302/5f6b2e6f61c9732f35109587/html5/thumbnails/16.jpg)
Snapping
Splitting of polygons into several polygons
8 / 22
![Page 17: Automatically repairing polygons and planar partitions ... · very slow for big polygons 12/22 \Visual repair" GRASS ArcGIS 13/22. Our solution = constrained triangulation (CT) 1](https://reader033.fdocuments.us/reader033/viewer/2022050302/5f6b2e6f61c9732f35109587/html5/thumbnails/17.jpg)
Snapping
High resolution data
Low resolution data
Topologically invalid result
8 / 22
![Page 18: Automatically repairing polygons and planar partitions ... · very slow for big polygons 12/22 \Visual repair" GRASS ArcGIS 13/22. Our solution = constrained triangulation (CT) 1](https://reader033.fdocuments.us/reader033/viewer/2022050302/5f6b2e6f61c9732f35109587/html5/thumbnails/18.jpg)
Topology rules
9 / 22
![Page 19: Automatically repairing polygons and planar partitions ... · very slow for big polygons 12/22 \Visual repair" GRASS ArcGIS 13/22. Our solution = constrained triangulation (CT) 1](https://reader033.fdocuments.us/reader033/viewer/2022050302/5f6b2e6f61c9732f35109587/html5/thumbnails/19.jpg)
Manual work
10 / 22
![Page 20: Automatically repairing polygons and planar partitions ... · very slow for big polygons 12/22 \Visual repair" GRASS ArcGIS 13/22. Our solution = constrained triangulation (CT) 1](https://reader033.fdocuments.us/reader033/viewer/2022050302/5f6b2e6f61c9732f35109587/html5/thumbnails/20.jpg)
“Buffer-by-0”
11 / 22
![Page 21: Automatically repairing polygons and planar partitions ... · very slow for big polygons 12/22 \Visual repair" GRASS ArcGIS 13/22. Our solution = constrained triangulation (CT) 1](https://reader033.fdocuments.us/reader033/viewer/2022050302/5f6b2e6f61c9732f35109587/html5/thumbnails/21.jpg)
“Buffer-by-0”
11 / 22
![Page 22: Automatically repairing polygons and planar partitions ... · very slow for big polygons 12/22 \Visual repair" GRASS ArcGIS 13/22. Our solution = constrained triangulation (CT) 1](https://reader033.fdocuments.us/reader033/viewer/2022050302/5f6b2e6f61c9732f35109587/html5/thumbnails/22.jpg)
“Buffer-by-0”
planar graph is constructed
11 / 22
![Page 23: Automatically repairing polygons and planar partitions ... · very slow for big polygons 12/22 \Visual repair" GRASS ArcGIS 13/22. Our solution = constrained triangulation (CT) 1](https://reader033.fdocuments.us/reader033/viewer/2022050302/5f6b2e6f61c9732f35109587/html5/thumbnails/23.jpg)
“Buffer-by-0”
Result
11 / 22
![Page 24: Automatically repairing polygons and planar partitions ... · very slow for big polygons 12/22 \Visual repair" GRASS ArcGIS 13/22. Our solution = constrained triangulation (CT) 1](https://reader033.fdocuments.us/reader033/viewer/2022050302/5f6b2e6f61c9732f35109587/html5/thumbnails/24.jpg)
PostGIS 2.0’s ST MakeValid()
high-level automatic repair function
diff functions called depending on geometric and topologicalconfigurations of rings
based on construction of planar graph (GEOS is used)
not documented (“read the code”) = predicting behaviour isdifficult
very slow for big polygons
12 / 22
![Page 25: Automatically repairing polygons and planar partitions ... · very slow for big polygons 12/22 \Visual repair" GRASS ArcGIS 13/22. Our solution = constrained triangulation (CT) 1](https://reader033.fdocuments.us/reader033/viewer/2022050302/5f6b2e6f61c9732f35109587/html5/thumbnails/25.jpg)
“Visual repair”
GRASS ArcGIS
13 / 22
![Page 26: Automatically repairing polygons and planar partitions ... · very slow for big polygons 12/22 \Visual repair" GRASS ArcGIS 13/22. Our solution = constrained triangulation (CT) 1](https://reader033.fdocuments.us/reader033/viewer/2022050302/5f6b2e6f61c9732f35109587/html5/thumbnails/26.jpg)
Our solution = constrained triangulation (CT)
1 Construct CT of inputpolygons
2 Flag each triangle with itspolygon / interior & exterior
3 Make each triangle haveexactly one tag
4 Reconstruct polygons
over
lapp
ing
region
"red"
"blue"
14 / 22
![Page 27: Automatically repairing polygons and planar partitions ... · very slow for big polygons 12/22 \Visual repair" GRASS ArcGIS 13/22. Our solution = constrained triangulation (CT) 1](https://reader033.fdocuments.us/reader033/viewer/2022050302/5f6b2e6f61c9732f35109587/html5/thumbnails/27.jpg)
Our solution = constrained triangulation (CT)
1 Construct CT of inputpolygons
2 Flag each triangle with itspolygon / interior & exterior
3 Make each triangle haveexactly one tag
4 Reconstruct polygons
"red"
"blue"
14 / 22
![Page 28: Automatically repairing polygons and planar partitions ... · very slow for big polygons 12/22 \Visual repair" GRASS ArcGIS 13/22. Our solution = constrained triangulation (CT) 1](https://reader033.fdocuments.us/reader033/viewer/2022050302/5f6b2e6f61c9732f35109587/html5/thumbnails/28.jpg)
Our solution = constrained triangulation (CT)
1 Construct CT of inputpolygons
2 Flag each triangle with itspolygon / interior & exterior
3 Make each triangle haveexactly one tag
4 Reconstruct polygons
A
C
D
B
"red"
"blue"
14 / 22
![Page 29: Automatically repairing polygons and planar partitions ... · very slow for big polygons 12/22 \Visual repair" GRASS ArcGIS 13/22. Our solution = constrained triangulation (CT) 1](https://reader033.fdocuments.us/reader033/viewer/2022050302/5f6b2e6f61c9732f35109587/html5/thumbnails/29.jpg)
Our solution = constrained triangulation (CT)
1 Construct CT of inputpolygons
2 Flag each triangle with itspolygon / interior & exterior
3 Make each triangle haveexactly one tag
4 Reconstruct polygons
Triangle Repair
ABCD
"red""red""red""red"
14 / 22
![Page 30: Automatically repairing polygons and planar partitions ... · very slow for big polygons 12/22 \Visual repair" GRASS ArcGIS 13/22. Our solution = constrained triangulation (CT) 1](https://reader033.fdocuments.us/reader033/viewer/2022050302/5f6b2e6f61c9732f35109587/html5/thumbnails/30.jpg)
Our solution = constrained triangulation (CT)
1 Construct CT of inputpolygons
2 Flag each triangle with itspolygon / interior & exterior
3 Make each triangle haveexactly one tag
4 Reconstruct polygons
"red"
"blue"
14 / 22
![Page 31: Automatically repairing polygons and planar partitions ... · very slow for big polygons 12/22 \Visual repair" GRASS ArcGIS 13/22. Our solution = constrained triangulation (CT) 1](https://reader033.fdocuments.us/reader033/viewer/2022050302/5f6b2e6f61c9732f35109587/html5/thumbnails/31.jpg)
Our solution = constrained triangulation (CT)
1 Construct CT of inputpolygons
2 Flag each triangle with itspolygon / interior & exterior
3 Make each triangle haveexactly one tag
4 Reconstruct polygons
"red"
"blue"
14 / 22
![Page 32: Automatically repairing polygons and planar partitions ... · very slow for big polygons 12/22 \Visual repair" GRASS ArcGIS 13/22. Our solution = constrained triangulation (CT) 1](https://reader033.fdocuments.us/reader033/viewer/2022050302/5f6b2e6f61c9732f35109587/html5/thumbnails/32.jpg)
Local control: 6 different operators
Repair operation Type Criteria
Triangle by number of Focal The label present in the largest number ofneighbours adjacent faces, overlaps included.Triangle by absolute majority Focal Label present in two or more valid
adjacent facesTriangle by longest boundary Focal Label present along the longest portion of
the boundary of the adjacent facesRegions by longest boundary Focal of Label present along the longest portion of
zonal the boundary of the adjacent facesRegions by random neighbour Focal of Random label from the adjacent faces
zonalTriangle by priority list Varies Label that has the highest priority according to
a predefined priority list
15 / 22
![Page 33: Automatically repairing polygons and planar partitions ... · very slow for big polygons 12/22 \Visual repair" GRASS ArcGIS 13/22. Our solution = constrained triangulation (CT) 1](https://reader033.fdocuments.us/reader033/viewer/2022050302/5f6b2e6f61c9732f35109587/html5/thumbnails/33.jpg)
Local control: one concrete example
16 / 22
![Page 34: Automatically repairing polygons and planar partitions ... · very slow for big polygons 12/22 \Visual repair" GRASS ArcGIS 13/22. Our solution = constrained triangulation (CT) 1](https://reader033.fdocuments.us/reader033/viewer/2022050302/5f6b2e6f61c9732f35109587/html5/thumbnails/34.jpg)
Local control: one concrete example
16 / 22
![Page 35: Automatically repairing polygons and planar partitions ... · very slow for big polygons 12/22 \Visual repair" GRASS ArcGIS 13/22. Our solution = constrained triangulation (CT) 1](https://reader033.fdocuments.us/reader033/viewer/2022050302/5f6b2e6f61c9732f35109587/html5/thumbnails/35.jpg)
Local control: one concrete example
16 / 22
![Page 36: Automatically repairing polygons and planar partitions ... · very slow for big polygons 12/22 \Visual repair" GRASS ArcGIS 13/22. Our solution = constrained triangulation (CT) 1](https://reader033.fdocuments.us/reader033/viewer/2022050302/5f6b2e6f61c9732f35109587/html5/thumbnails/36.jpg)
Local control: one concrete example
16 / 22
![Page 37: Automatically repairing polygons and planar partitions ... · very slow for big polygons 12/22 \Visual repair" GRASS ArcGIS 13/22. Our solution = constrained triangulation (CT) 1](https://reader033.fdocuments.us/reader033/viewer/2022050302/5f6b2e6f61c9732f35109587/html5/thumbnails/37.jpg)
Local control: one concrete example
16 / 22
![Page 38: Automatically repairing polygons and planar partitions ... · very slow for big polygons 12/22 \Visual repair" GRASS ArcGIS 13/22. Our solution = constrained triangulation (CT) 1](https://reader033.fdocuments.us/reader033/viewer/2022050302/5f6b2e6f61c9732f35109587/html5/thumbnails/38.jpg)
Experiments with big polygons: CORINE2006
32 473 points346 rings
2 412 points10 rings
102 272 points299 rings
points rings prepair ST MakeValid()
EU-47552 2 412 10 0.5s 0.8sEU-47997 32 473 346 11.4s 314.0sEU-180927 102 272 299 52.2s 740.2s
17 / 22
![Page 39: Automatically repairing polygons and planar partitions ... · very slow for big polygons 12/22 \Visual repair" GRASS ArcGIS 13/22. Our solution = constrained triangulation (CT) 1](https://reader033.fdocuments.us/reader033/viewer/2022050302/5f6b2e6f61c9732f35109587/html5/thumbnails/39.jpg)
Experiments with large real-world datasets
(a) E41N27 (b) 4tiles
(c) 16tiles (d) Mexico18 / 22
![Page 40: Automatically repairing polygons and planar partitions ... · very slow for big polygons 12/22 \Visual repair" GRASS ArcGIS 13/22. Our solution = constrained triangulation (CT) 1](https://reader033.fdocuments.us/reader033/viewer/2022050302/5f6b2e6f61c9732f35109587/html5/thumbnails/40.jpg)
Experiments with large real-world datasets
# pts avg # pts# polygons # pts largest polygon per polygon
E41N27 14 969 496 303 26 740 344tiles 4 984 365 702 16 961 7516tiles 63 868 6 622 133 95 112 104Mexico 26 866 4 181 354 117 736 156
19 / 22
![Page 41: Automatically repairing polygons and planar partitions ... · very slow for big polygons 12/22 \Visual repair" GRASS ArcGIS 13/22. Our solution = constrained triangulation (CT) 1](https://reader033.fdocuments.us/reader033/viewer/2022050302/5f6b2e6f61c9732f35109587/html5/thumbnails/41.jpg)
Comparison with other GIS packages
pprepair ArcGIS FME GRASS
memory time memory time memory time memory time
E41N27 145 MB 19s 145 MB 1m3s 158 MB 31s 59 MB 3m09s4tiles 116 MB 17s 113 MB 37s 105 MB 31s 49 MB 53s16tiles 1.45 GB 4m47s crashes – 636 MB 15m48s crashes –Mexico 1.01 GB 3m31s 216 MB >1d 264 MB 2m45s 408 MB 11m38s
20 / 22
![Page 42: Automatically repairing polygons and planar partitions ... · very slow for big polygons 12/22 \Visual repair" GRASS ArcGIS 13/22. Our solution = constrained triangulation (CT) 1](https://reader033.fdocuments.us/reader033/viewer/2022050302/5f6b2e6f61c9732f35109587/html5/thumbnails/42.jpg)
The code is robust and freely available
http://tudelft-gist.github.com/pprepair
Uses OGR and CGALBSD license → soon GPLv3
21 / 22
![Page 43: Automatically repairing polygons and planar partitions ... · very slow for big polygons 12/22 \Visual repair" GRASS ArcGIS 13/22. Our solution = constrained triangulation (CT) 1](https://reader033.fdocuments.us/reader033/viewer/2022050302/5f6b2e6f61c9732f35109587/html5/thumbnails/43.jpg)
Thanks for your attention
Ken Arroyo [email protected]
Hugo [email protected]
Martijn [email protected]
22 / 22