3

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 '17 at 18:20
  • i edited the post think you – AhmeX2 Mar 6 '17 at 8:41
2

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, privacy policy and cookie policy

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