Should support clockwise/counterclockwise rings when converting from ArcGIS to Geojson
patrickarlt opened this issue · 1 comments
We need to get final confirmation on what the ArcGIS JSON spec says about ring orientation. http://help.arcgis.com/en/arcgisserver/10.0/apis/rest/geometry.html makes no mentions of how to construct polygons with holes.
In a gis.stackexchange.com thread (http://gis.stackexchange.com/questions/2749/esri-json-polygon-ring-orientation) @swingley makes says that...
It looks like if you add rings that fall inside an existing ring, the interior rings are holes. If you add a ring that is not inside another ring, it's added as an additional polygon which is basically a multi-polygon.
The sample in that thread has a polygon with 2 holes with one counterclockwise ring and one clockwise ring so it looks like ring orientation does not determine is a ring is a hole or not.
In #88 I added support for this to the ArcGIS parser. When a ArcGIS polygon is parsed into GeoJSON every ring is checked against every other ring to see if anything contains it. We can construct polygons and multipolygons w/ holes this way.
NOTE Since Terraformer.arrayIntersectsArray
and Terraformer.coordinatesContainPoint
uses cartesian math to calculate when shapes intersect this method MAY be inaccurate for very large (state level) shapes.