On mardi 28 février 2017 17:25:51 CET TazMainiac wrote:
> Hi All,
> 
> When I use ogr2ogr to process a shape file (into KML for examle) that has
> "invalid" polygons (self-intersections or other problems) in it, it "cleans
> them up", such that they are valid.  Is there a description anywhere of
> what algorithm it's using to do this cleanup?  

Hum, there's not really such a cleanup algorithm. When writing a shapefile, 
there's some 
"topological analysis" to figure out which rings of a (multi)polygon are inside 
others, so as to 
respect the shapefile specification, but that's all. I'd be surprised that 
self-intersections of a 
ring are corrected for example.

if you want to explicitly remove invalid geometries, you can do something like:

ogr2ogr out.shp in.kml \
  -sql "SELECT * FROM input_layer WHERE ST_IsValid(geometry)" -dialect SQLite

Even


-- 
Spatialys - Geospatial professional services
http://www.spatialys.com
_______________________________________________
gdal-dev mailing list
[email protected]
https://lists.osgeo.org/mailman/listinfo/gdal-dev

Reply via email to