[gdal-dev] curved polygon -> polygon
even.rouault at spatialys.com
Wed Nov 26 03:43:07 PST 2014
Le mercredi 26 novembre 2014 12:17:38, Martin Landa a écrit :
> I wonder why curved polygons are not approximated to polygons somehow
> automatically. Eg. conversion such data fails
> $ ogr2ogr -f PostgreSQL PG:dbname=ruian_test
> .xml.gz Parcely -overwrite
> Warning 1: Geometry to be inserted is of type Curve Polygon, whereas
> the layer geometry type is Polygon.
> Insertion is likely to fail
> ERROR 1: COPY statement failed.
> ERROR: Geometry type (CurvePolygon) does not match column type (Polygon)
> CONTEXT: COPY parcely, line 18, column originalnihranice:
> because some features are curved polygons even geometry column is
The PostGIS driver doesn't do automatic conversion of geometry types as it can
support all (you would get similar errors if inserting polygons into a
multipolygon layer, or the reverse). This is kind of historic behaviour.
You can fix the error by specifying either -nlt CONVERT_TO_LINEAR (or -nlt
POLYGON), or -nlt CURVEPOLYGON
Actually digging more, I was convinced that in my work related to curve
geometries, I had make sure that the GML reader does its best to convert each
geometry to the layer declared geometry type. This indeed worked for single
geometry column layers, but not for multiple geometry such as yours. I've just
So, with your current data/ruian_vf_ob_v1.gfs, the curve polygons will be
converted/approximated to polygons. You can also change
data/ruian_vf_ob_v1.gfs to declare OriginalniHranice as curvepolygon. And
polygons will be converted to curvepolygons (lossless conversion of course).
In both cases, PostGIS should be happy.
Spatialys - Geospatial professional services
More information about the gdal-dev