<div dir="ltr"><div>I finally got around to doing a rough implementation of parsing ESRIJSON with curved geometries.  The code is very rough yet, but works enough to import a polygon layer from an ESRI FeatureService into PostGIS with the curves intact.  Code is available at [1].<br><br></div>Main issues: <br><br>I don't know how to detect if there will be curves in the source file without first parsing the whole file, so currently I just assume a curved geometry type.  This might be a candidate for an open option.<br><div><br>My focus has been on polygon layers (because that's the dataset I need to read).  I doubt it works outside of polygon layers at the moment.<br><br></div><div>I had to enable the "Curve Geometries" capability in the top level GeoJSON driver (which may break some things for the GeoJSON/TopoJSON drivers).<br></div><div><br></div><div>Memory management and error handling need to be improved.<br><br></div><div>I only implemented circular curves ("c").  There are other curve types supported by the spec, (e.g. Bézier), but I don't have any examples of these other types in the datasets I have on hand.<br></div><div><br>[1] <a href="https://github.com/klassenjs/gdal/tree/esrijson-curves">https://github.com/klassenjs/gdal/tree/esrijson-curves</a><br><br><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Oct 19, 2017 at 4:55 PM, James Klassen <span dir="ltr"><<a href="mailto:klassen.js@gmail.com" target="_blank">klassen.js@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><span class="">On Thu, Oct 19, 2017 at 2:04 PM, Even Rouault <span dir="ltr"><<a href="mailto:even.rouault@spatialys.com" target="_blank">even.rouault@spatialys.com</a>></span> wrote:<br></span><div class="gmail_extra"><div class="gmail_quote"><span class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span>On jeudi 19 octobre 2017 13:38:38 CEST James Klassen wrote:<br>
> Has anyone looked at reading curved geometries from an Esri rest service<br>
> queried with "returnTrueCurves=true"?<br>
><br>
> My end goal is to import the data into PostGIS. We were successful using<br>
> ogr2ogr to translate the curved features from a geodatabase download in the<br>
> past, but that download is being replaced with a rest service.  OGR reads<br>
> the rest service correctly without "returnTrueCurves=true", but we would<br>
> like to preserve the integrity of the curves in the source data if possible.<br>
><br>
> It doesn't look like there is any code in GDAL 2.2 to deal with this<br>
> situation.  `ogresrijsonreader.cpp:OGRESRI<wbr>JSONReadPolygon()` looks like it<br>
> is only looking for a "rings" member, not "curveRings", etc.<br>
<br>
</span>This is indeed not supported at the moment.<br>
It appears to be documented in<br>
<a href="http://resources.arcgis.com/en/help/arcgis-rest-api/index.html#//02r3000000n1000000%23CURVE" rel="noreferrer" target="_blank">http://resources.arcgis.com/en<wbr>/help/arcgis-rest-api/index.ht<wbr>ml#//02r3000000n1000000#CURVE</a><br>
<br>
The data model is, non suprisingly, super close to what exists in Personnal Geodatabase<br>
or FileGeodatabase. Arc/CircularArc could be translated to CIRCULARSTRING/COMPOUNDCURVE/<br>
CURVEPOLYGON. Bezier curves would have to be linearized since there's no equivalent in<br>
OGC SF / ISO SQL-MM Part 3 standards.<br>
So this is "just" a matter of coding it.<br>
<span class="m_2640771505834419425m_-6437039657725241648HOEnZb"></span><br></blockquote><div><br></div></span><div>Interesting.  So, some new JSON parsing code feeding into similar code to what already exists in other drivers to create the right OGR objects.  It just comes down to time and/or money to actually implement it.<br><br></div></div></div></div>
</blockquote></div><br></div></div>