[gdal-dev] ogr2ogr CircleByCenterPoint convert problem

Zakrzewski Stefan Stefan.Zakrzewski at gugik.gov.pl
Mon Mar 21 07:56:21 PDT 2016


Thank you for your quick answer. I have followed your suggestion and the problem is almost solved. On another data set, there are some imperfections but I'm still working on it .

Proper command is:
ogr2ogr -f "ESRI Shapefile" "file.shp" "file.gml" -overwrite -skipfailures -splitlistfields -where OGR_GEOMETRY='CURVEPolygon' -nlt CURVE_TO_LINEAR
ogr2ogr -f "ESRI Shapefile" "file.shp" "file.gml" -append -skipfailures -splitlistfields -where OGR_GEOMETRY='Polygon'

Regards
Stefan

-----Original Message-----
From: Even Rouault [mailto:even.rouault at spatialys.com] 
Sent: Friday, March 11, 2016 10:37 AM
To: gdal-dev at lists.osgeo.org
Cc: Zakrzewski Stefan
Subject: Re: [gdal-dev] ogr2ogr CircleByCenterPoint convert problem

Le vendredi 11 mars 2016 10:28:43, Zakrzewski Stefan a écrit :
> Hi Everyone.
> 
> For several days I try to convert GML file for SHP. It contains 
> objects in three geometry types: point, linear and polygon. They are 
> located on several layers, each of which may contain all types of 
> geometry. Some of polygon features are stored as CircleByCenterPoint.
> 
> After download GDAL 2.02 I've used this command:
> ogr2ogr -f "ESRI Shapefile" "file.shp" "file.gml" -overwrite 
> -skipfailures -splitlistfields -where OGR_GEOMETRY='Polygon' -nlt 
> CURVE_TO_LINEAR

I suspect this will not do what you intend. The -where OGR_GEOMETRY='Polygon'  
is applied *before* conversion of curves to linear geometries.
So either modify your where clause to select the curve geometries you want (you can use the OR boolean operator ), or do the filtering in a second stage by first outputing to let's say a temporary Spatialite and then convert to shape

> 
> For one layer in GML file ogr2ogr has made polygon features for circles,
> but for another completely not. I have checked twice and GML feature
> members in both layers are the same.

If your GML file has several layers, your above method will not merge them into 
a single shapefile.

You could do a ogr2ogr temporary_shp_directory file.gml [....]

and then merge all the shapefiles in temporary_shp_directory into a single one 
by using ogr2ogr / ogr2ogr -append

> 
> I've tried use CURVEPOLYGON, CIRCULARSTRING and got no polygons for Circles
> in shape file.
> 
> Any hints?
> 
> Regards
> Stefan

-- 
Spatialys - Geospatial professional services
http://www.spatialys.com


More information about the gdal-dev mailing list