[gdal-dev] Improve clipping of shapefiles

Mike Toews mwtoews at gmail.com
Mon Sep 11 14:34:34 PDT 2017


On 11 September 2017 at 21:09, Paul Meems <bontepaarden at gmail.com> wrote:
> I have a large shapefile with over 2.8 million shapes (fishnet) and I have a
> border file with only 1 multipolygon.
>
> I'm trying to clip the fishnet with the border.
> Using code is takes about 5 min. using command line it takes even longer.
>
> This is my command:
> ogr2ogr fishnetClipped.shp fishnet.shp -clipsrc border.shp
> ...
> Can I somehow improve the speed?

If the fishnet shapefile does not have a spatial index, try creating
one. There are a few ways to do this:
http://www.gdal.org/drv_shapefile.html

I'm not sure if -clipsrc datasource will use the spatial index, but
it's worth trying.


More information about the gdal-dev mailing list