I have two shapefiles, a polygon shapefile (lake) and a line shapefile (boudary) I want to create a new shapefile containing the polygon splitted by the polyline using ogr2ogr.

oginal shapes

Result how can i do this?

  • 2
    It is not clear what do you mean by 'Split'? Can you elaborate a bit more?
    – nash
    Mar 5, 2017 at 18:20
  • i edited the post think you
    – AhmeX2
    Mar 6, 2017 at 8:41

1 Answer 1


If we have GDAL OGR with Spatialite support and liblwgeom (e.g. OSGeo4W):

ogr2ogr splitted_lake.shp lake.shp -dialect sqlite -sql "SELECT ST_Split(g1.geometry,g2.geometry) AS geometry FROM lake AS g1, 'boundary.shp'.'boundary' AS g2" -explodecollections

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.