Nelson A. de Oliveira wrote > Hi! > > Sorry if it's not the appropriated place to ask this, but is there a > way to convert MULTILINESTRING to LINESTRING? > For example: > > ===== > ogr2ogr -f "SQLite" -gt 65536 -dsco SPATIALITE=YES database.sqlite > shape.shp > ERROR 1: Cannot insert feature with geometry of type MULTILINESTRING > in column GEOMETRY. Type LINESTRING expected > ERROR 1: Unable to write feature 178 from layer merged. > ERROR 1: Terminating translation prematurely after failed > translation of layer merged (use -skipfailures to skip errors) > ===== > > I don't want to skip the features, but convert them. > > I could open the shapefile in QGIS and use "Multipart to Singleparts", > but it will be a non-automatic and non-cli step. > Is there a way to do this with ogr2ogr (or other related tool), please? > > Thank you! > > Best regards, > Nelson
If you want to write all that you have in the shapefile into Spatialite, use ogr2ogr with switch -nlt PROMOTE_TO_MULTI. Obviously your shapefile contains a mixture of linestrings and multilinestrings. However, if you want to explode multilinestrings into linestrings use switch -explodecollections. Both are documented in http://www.gdal.org/ogr2ogr.html. -- View this message in context: http://osgeo-org.1560.x6.nabble.com/gdal-dev-Converting-MULTILINESTRING-to-LINESTRING-tp5296370p5296402.html Sent from the GDAL - Dev mailing list archive at Nabble.com. _______________________________________________ gdal-dev mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/gdal-dev
