I am trying to convert an .osm file to a .shp file.

I am using OGR2OGR. There is an article at Openstreetmap which explains how this can be done. Here is an example command:

ogr2ogr.exe --config OSM_USE_CUSTOM_INDEXING NO -skipfailures -f "ESRI Shapefile" output.shp input.osm

And it works perfectly. As a result of upper command, in the "output.shp" folder I get four separate .shp files: lines.shp, multilinestrings.shp, multipolygons.shp, points.shp

However what I would like to get is a single .shp file. So basically to convert an .osm file to a single .shp file.

Is it possible to do that directly through some change of the upper command?

If not then I tried to merge all these four .shp file into a single .shp file (merged.shp). I found an example topic here at gis.stackexchange. So I used the following 4 commands:

ogr2ogr.exe -f "ESRI Shapefile" merged.shp lines.shp
ogr2ogr.exe -skipfailures -f "ESRI Shapefile" -update -append merged.shp multilinestrings.shp
ogr2ogr.exe -skipfailures -f "ESRI Shapefile" -update -append merged.shp multipolygons.shp
ogr2ogr.exe -skipfailures -f "ESRI Shapefile" -update -append merged.shp points.shp

And the merged.shp file is created, but an error is raised at the upper last (fourth) command:

Attempt to write non-linestring (POINT) geometry to ARC type shapefile.

I tried to google but I couldn't solve this error.

Can somebody please help me?

  • 2
    From what I understand, you're trying to combine points, lines and polygons into one shapefile... That's impossible. Shapefiles only hold a single geometry type per file.
    – Fezter
    Oct 28 '16 at 0:54
  • 2
    Do you mean attributes? Yes, you can certainly do that, but I suggest asking a new question. And include the software you have available.
    – Fezter
    Oct 28 '16 at 1:11
  • 2
    No, the question has been closed as a duplicate and cannot accept answers.
    – Fezter
    Oct 28 '16 at 1:16
  • 1
    You may change to some other format that allows mixed geometries.
    – AndreJ
    Oct 28 '16 at 6:00
  • 1
    Geojson would be my best bet. gml and kml will work too, and spatialite stores all geometry types in different tables within the same file. Ogr2ogr can export to all of them.
    – AndreJ
    Oct 28 '16 at 17:23