[gdal-dev] openFileGDB driver - polygons with bezier curves not exporting correctly

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[gdal-dev] openFileGDB driver - polygons with bezier curves not exporting correctly

obrl soil
Hi,

Cross-posting from
https://gis.stackexchange.com/questions/264026/gdal-and-openfilegdb-driver-polygons-with-bezier-curves-not-exporting-correctl

System: Win 7, OSgeo4W package 64 bit (current to 3/12/17), GDAL 2.2.3

I have been provided with a polygon layer in ESRI FileGDB format
(created in ArcMap v10.3 at least, maybe 10.4 or 10.4.1). The polygons
in the layer have been digitised using a mix of straight line segments
and bezier curves / true arcs, which I've verified in ArcMap by
looking at the geometry in edit mode.

GDAL > 2.2.0 should be able to read and export CURVE-type geometries
correctly (e.g. to GPKG, which can support those geometry types) but I
can't get the export to work; e.g.

    # OGR_SKIP just forces use of OpenFileGDB driver, but the
    # same thing happens with either:

    ogr2ogr --config OGR_SKIP FileGDB -f GPKG C:/DATA/output.gpkg
C:/DATA/input.gdb LAYERNAME

still converts all the curves to a million tiny straight line
segments. The output file size balloons to ~300MB (from an 8MB source
file), making the data almost impossible to use. Even plotting is
difficult, forget any further geometric ops. Trying to force the issue
with -nlt CURVEPOLYGON has had no effect. Opening the layer in QGIS
2.18.14 produces the same results, as does import to R with
sf::st_read (these two rely on GDAL 2.2.3 and 2.2.0 respectively to
access GDBs on my machine).

ogrinfo reports the geometry type for the layer as Multi Polygon, as
does QGIS - and even Arc itself reports them as 'Polygon' in its own
Layer Properties interface, but I don't think the Feature Class
definition distinguishes between different polygon types.

Is this a GDAL bug (eg driver mis-detecting geom type) or an Arc bug
(eg some kind of failure to metadata properly)?

The gdb in question is at
https://github.com/obrl-soil/bits-n-pieces/tree/master/curvepolys

thanks,
Lauren
_______________________________________________
gdal-dev mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/gdal-dev
Reply | Threaded
Open this post in threaded view
|

Re: openFileGDB driver - polygons with bezier curves not exporting correctly

Even Rouault-2

> I have been provided with a polygon layer in ESRI FileGDB format

> (created in ArcMap v10.3 at least, maybe 10.4 or 10.4.1). The polygons

> in the layer have been digitised using a mix of straight line segments

> and bezier curves / true arcs, which I've verified in ArcMap by

> looking at the geometry in edit mode.

>

 

Lauren,

 

Bezier curves have no equivalent representation in Single Feature modelling, so they are linearized as small straight segments. Up to now, 100 intermediate points were used, which in a case like your dataset was indeed excessive. I've tweaked the logic in trunk to be smarter (taking into account the angular difference between the start and end tangents, and the relative length of those tangents vs the direct distance), and now the resulting GPKG from the conversion is 9 MB, with after a quick visual check is nearly rendered the same as the previous brute force version

 

https://trac.osgeo.org/gdal/changeset/40941

 

Regarding layer geometry types, given that there will be a mix of MultiPolygon and MultiSurface (MultiSurface due to the polygons with circular portion), and that this cannot be anticipated before reading the layer content, you may want to either add "-nlt MULTISURFACE" (that will keep the circular portion as such), or "-nlt MULTIPOLYGON") (to linearize everything). On your sample dataset, the difference of size is neglectable: 9064448 for the output of -nlt MYLTISURFACE vs 9080832 for the output of -nlt MULTIPOLYGON.

 

Even

 

--

Spatialys - Geospatial professional services

http://www.spatialys.com


_______________________________________________
gdal-dev mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/gdal-dev
Reply | Threaded
Open this post in threaded view
|

Re: openFileGDB driver - polygons with bezier curves not exporting correctly

obrl soil
Even, thanks so much for the rapid fix. I'll test it out once the
OSGeo4W gdal-dev version updates.

Regards
Lauren

On Mon, Dec 4, 2017 at 10:42 PM, Even Rouault
<[hidden email]> wrote:

>> I have been provided with a polygon layer in ESRI FileGDB format
>
>> (created in ArcMap v10.3 at least, maybe 10.4 or 10.4.1). The polygons
>
>> in the layer have been digitised using a mix of straight line segments
>
>> and bezier curves / true arcs, which I've verified in ArcMap by
>
>> looking at the geometry in edit mode.
>
>>
>
>
>
> Lauren,
>
>
>
> Bezier curves have no equivalent representation in Single Feature modelling,
> so they are linearized as small straight segments. Up to now, 100
> intermediate points were used, which in a case like your dataset was indeed
> excessive. I've tweaked the logic in trunk to be smarter (taking into
> account the angular difference between the start and end tangents, and the
> relative length of those tangents vs the direct distance), and now the
> resulting GPKG from the conversion is 9 MB, with after a quick visual check
> is nearly rendered the same as the previous brute force version
>
>
>
> https://trac.osgeo.org/gdal/changeset/40941
>
>
>
> Regarding layer geometry types, given that there will be a mix of
> MultiPolygon and MultiSurface (MultiSurface due to the polygons with
> circular portion), and that this cannot be anticipated before reading the
> layer content, you may want to either add "-nlt MULTISURFACE" (that will
> keep the circular portion as such), or "-nlt MULTIPOLYGON") (to linearize
> everything). On your sample dataset, the difference of size is neglectable:
> 9064448 for the output of -nlt MYLTISURFACE vs 9080832 for the output of
> -nlt MULTIPOLYGON.
>
>
>
> Even
>
>
>
> --
>
> Spatialys - Geospatial professional services
>
> http://www.spatialys.com
_______________________________________________
gdal-dev mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/gdal-dev