[gdal-dev] Clipping shapefile with another produces invalid shapes

Paul Meems bontepaarden at gmail.com
Thu Oct 12 12:31:16 PDT 2017


 Hi list,

I have a very large shapefile, with almost 700k shapes which I want to clip
with a border shapefile (in red):
https://ibb.co/gKth1G

I'm using this command:
ogr2ogr -clipsrc "border.shp" -overwrite -explodecollections -f "ESRI
Shapefile" ogr_clipped.shp Fishnet.shp
with GDAL 2.1.3, released 2017/20/01
Eventually, I'll transform the command to a call to ogr.VectorTranslate().

The result is visually correct:
https://ibb.co/hOvJab

But at the red asterix, I have an invalid shape. The reason is according to
GEOS:
Polygon must be clockwise
I have more of these errors.
They all seem to occur when the shape due to the clipping is triangular
shaped:
https://ibb.co/cKuY8w
https://ibb.co/eXcWvb

Is this an error/warning which can be expected or do I need to add an
additional parameter?
If needed I can try to make a test set with as little data as possible.

Thanks,

Paul
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20171012/ec162ab5/attachment.html>


More information about the gdal-dev mailing list