[gdal-dev] ArcGIS RestAPI JSON Polygons

Even Rouault even.rouault at mines-paris.org
Thu Jun 26 13:26:22 PDT 2014


Le lundi 23 juin 2014 03:32:32, Jeremy Palmer a écrit :
> I'm querying an ArcGIS service obtain polygon data, however the service
> seems to define Island multi-polygons objects as single polygons with
> multiple exterior rings. This creates invalid OGC geometries and is
> causing processing problems in my workflow.
> 
> He's the service and a validation test showing the polygon is not valid:
> 
> ogrinfo -dialect sqlite -sql "SELECT TA2013_V1_00_NAME,
> ST_IsValid(GEOMETRY) FROM OGRGeoJSON"
> http://maps.stats.govt.nz/wss/service/arcgis1/guest/Boundaries/2013_Geogra
> phies/MapServer/9/query?f=json&objectIds=36&returnGeometry=true&outSR=4167
> 
> GEOS warning: Hole lies outside shell at or near point 174.78189611685229
> -41.077770200471164
> 
> Layer name: SELECT
> Geometry: None
> Feature Count: 1
> Layer SRS WKT:
> (unknown)
> TA2013_V1_00_NAME: String (0.0)
> ST_IsValid(GEOMETRY): Integer (0.0)
> OGRFeature(SELECT):0
>   TA2013_V1_00_NAME (String) = Porirua City
>   ST_IsValid(GEOMETRY) (Integer) = 0
> 
> Is this a bug in the data from the service, or just the way the Esri
> defines geometry objects (and therefor an OGR bug)? I can't see a
> definition for multi-polygons in Esri API docs:
> 
> http://resources.arcgis.com/en/help/arcgis-rest-api/index.html#//02r3000000
> n1000000

Looking at the ogresrijsonreader.cpp code I can see I assumed that a 
esriPolygon was just a OGC Polygon, so with outer ring first and then inner 
rings. Fixing the code to support multi polygons should basically be a matter 
of calling OGRGeometryFactory::organizePolygons.

Even

-- 
Geospatial professional services
http://even.rouault.free.fr/services.html


More information about the gdal-dev mailing list