I am mainly interested in why and how the Simplify Polygons tool in ArcGIS for Desktop handles the simplification process, including preventing and resolving topological errors better than the equivalent ST_SimplifyPreserveTopology in PostGIS destroys topology when trying to simplify to similar levels.
Use case scenario: PostGIS database queried for vectorr GeoJSON polygon overlay in Leaflet. One can pass the ST_SimplifyPreserveTopology to the geometry field but my tests have shown that preprocessing data in ArcGIS gives me smaller datasets and topological correctness.
Here is an example:
Case 1 - Original data
Case 2 - ST_SimplifyPreserveTopology(the_geom,0.001)the_geom
note: querying from CartoDB
Further, when simplifying Case 1's data in ArcGIS for Desktop, there are no topology errors produced (ArcGIS for Desktop can resolve all errors).
Answer
Both ArcGIS and PostGIS use the Douglas-Peucker algorithm for simplification. This performs what ESRI calls point-remove simplification. ESRI also does a bend simplify which uses shape recognition (Wang) and not Douglas-Peucker.
Therefore, assuming you are using point-remove for your simplification in Arc, there are two options to explain the differences I can think of:
- The tolerance has been set differently in Arc compared to PostGIS (possible if you are just accepting defaults)
- ESRI has an environment parameter for snapping vertices together, which may be resulting in the smaller final dataset by snapping a lot of vertices as a by-product of the process.
As for topological correctness, until recently I would have expected you to say that it was ESRI who were getting it wrong (because that was my experience of doing this sort of operation), but recent simplification work in Arc10 has given me no topological errors - so presumably they fixed something! I'm afraid, though, I don't know why PostGIS is breaking the topology.
[MORE INFO AS PER REQUEST] ArcGIS has a setting that determines the minimum allowable XY separation of vertices. If the vertices fall below this tolerance, they are automatically snapped. This tolerance masquerades under three names:
- XY Tolerance (settable as an environment parameter)
- 'Cluster Tolerance' (Settable as part of a topology definition)
- 'Fuzzy tolerance' in the good old days of Coverages (unless you use Coverages - ignore this... but it is essentially the same thing).
The first two are synonymous but ESRI likes to proliferate obfuscation. ArcGIS sets this automatically based on some magic formula it determines, which means it can change when you do operations on your data. However, you can also set this yourself - a trick I often use to automatically reduce the data density following all sorts of operations.
No comments:
Post a Comment