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.
1 Answer
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