Thanks a Ton, Ujaval! The following command gave me the expected output: `ogr_layer_algebra.py ERASE -input_ds line.shp -method_ds polygon.shp -output_ds output.shp`
Regards, Devdatta On Wed, 10 May 2023 at 13:30, Ujaval Gandhi <uja...@spatialthoughts.com> wrote: > There's a new script for doing vector overlays called ogr_layer_algebra. > You can try that https://gdal.org/programs/ogr_layer_algebra.html > <https://mailtrack.io/trace/link/8844f1b0a00bc9c8c6b7d994f2ef6776bbbad413?w=ZGV2ZGF0dGFAdGVuZ3NoZS5pbg&url=https%3A%2F%2Fgdal.org%2Fprograms%2Fogr_layer_algebra.html&userId=8747767&signature=f3a663794cf05dc3> > --- > Ujaval Gandhi > Spatial Thoughts > www.spatialthoughts.com > <https://mailtrack.io/trace/link/4ddad0f9cf2b5c3c4c75c835dbf4a885ea30591b?w=ZGV2ZGF0dGFAdGVuZ3NoZS5pbg&url=http%3A%2F%2Fwww.spatialthoughts.com&userId=8747767&signature=de7d85fbbe1e0bcd> > > > > On Wed, May 10, 2023 at 1:26 PM Devdatta Tengshe <devda...@tengshe.in> > wrote: > >> I have a shapefile with lines, and another with polygons. I want to >> generate an output of those lines that are not covered by any polygon. >> >> I can perfectly do this in QGIS's Difference tool, but want to do it with >> og2ogr. (since it will be a part of a cronjob) >> >> I tried to do it, using the following command: >> `ogr2ogr -overwrite out.shp line.shp -dialect SQLite -sql "select >> st_difference(a.geometry, b.geometry) as geometry from line as a, >> 'polygon.shp'.polygon as b"` >> >> But it just generated a .dbf file. >> >> This behavior has also been reported here: >> https://gis.stackexchange.com/a/324837/442 >> >> Is this a bug, or expected behavior? Is there a better way to achieve >> what I want to? >> >> >> Regards, >> Devdatta >> _______________________________________________ >> gdal-dev mailing list >> gdal-dev@lists.osgeo.org >> https://lists.osgeo.org/mailman/listinfo/gdal-dev >> >
_______________________________________________ gdal-dev mailing list gdal-dev@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/gdal-dev