[gdal-dev] How to get the same behaviour as the 'Difference tool' of QGIS, in ogr2ogr?

Ujaval Gandhi ujaval at spatialthoughts.com
Wed May 10 01:00:23 PDT 2023


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?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?url=http%3A%2F%2Fwww.spatialthoughts.com&userId=8747767&signature=de7d85fbbe1e0bcd]




[data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=3D]
On Wed, May 10, 2023 at 1:26 PM Devdatta Tengshe <devdatta at 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 [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 at lists.osgeo.org [gdal-dev at lists.osgeo.org]
> https://lists.osgeo.org/mailman/listinfo/gdal-dev
> [https://lists.osgeo.org/mailman/listinfo/gdal-dev]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20230510/9b530909/attachment.htm>


More information about the gdal-dev mailing list