I’m trying to do a simple difference between two polygons using ogr, but I can’t make it work. The input layers have the same CRS. The input polygon is a multipolygon, and the overlay polygon is the result of merged polygons.

I’m using this code:

ogr2ogr diff8.shp project_landuse.shp -dialect sqlite -sql "SELECT ST_Difference(project_landuse.Geometry, 'merge_terrain_dissolve.Geometry) AS Geometry FROM project_landuse a LEFT JOIN 'merge_terrain_dissolve.shp'.'merge_terrain_dissolve' b

The result looks like this:

enter image description here

And should look like this:

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.