2

How can I convert an OSM file to Shapefile? Is there a good tool or a good web page.

I tried this link https://code.google.com/archive/p/osm2shp/, but there is an error.

  • It would help if you described the error perhaps? – Stev_k Aug 24 '18 at 12:31
  • Please let us know the error and we will help if we can. – Cody Brown Aug 24 '18 at 12:35
  • The code.google.com system is no longer supported by google so I suspect the code on there is out of date even if you can still download it. The ogr2ogr utility can convert .osm to .shp (and to even better formats, like GeoPackage). Try using that. – Spacedman Aug 24 '18 at 13:27
  • Thank you ver much . First App said to download .Net Framework 3.5 to work then i tried to install it and i get this Fehlercode: 0x800F081F – Majd Aug 24 '18 at 15:50
  • Thanks you very much Spacedman. How can i use this utility ist this .exe program? or can one use it with command line – Majd Aug 24 '18 at 15:54
5

If you install the GDAL and OGR tools (open source, available for all major operating systems, see osgeo.org for downloads and details) you can do this on a command line:

$ ogr2ogr maps map.osm

and it will extract the OSM file into an existing folder called "maps" as several shapefiles. Note that OSM layers can contain more than one geometry type, but shapefiles can't, so you might see:

ERROR 6: Geometry type of `Geometry Collection' not supported in shapefiles.  Type can be overridden with a layer creation option of SHPT=POINT/ARC/POLYGON/MULTIPOINT/POINTZ/ARCZ/POLYGONZ/MULTIPOINTZ/MULTIPATCH.

Better to save to a GeoPackage, which can handle Geometry Collection and long field names (another source of shapefile errors):

$ ogr2ogr -f GPKG map.gpkg map.osm
0...10...20...30...40...50...60...70...80...90...100 - done.

now you have a GeoPackage file that contains all the layers which can be read in most major GIS packages.

  • Spacedman. Can you please more help i installed this tool and then i wrote in command line (Windows 10) C:\Programme\gdal>ogr2ogr -f "ESRI Shapefile" outputdir "C:\Users\alo\Desktop\London.osm" but i get message error ( ERROR 1: Could not parse configuration file for OSM import FAILURE: Unable to open datasource `C:\Users\alo\Desktop\London.osm' with the following drivers... what shoul i do – Majd Aug 24 '18 at 23:09
  • If you are having trouble at the command line I'd recommend installing QGIS and the Quick OSM plugin which has a tool for importing from an OSM file. Your problem seems to be that ogr2ogr can't find a configuration file that it needs: gis.stackexchange.com/questions/75048/… – Spacedman Aug 25 '18 at 7:29
  • Thnkas very much it worked ogr2ogr -f GPKG map.gpkg "C:\Users\alo\Desktop\London.osm" – Majd Aug 25 '18 at 13:38
  • Maybe you can find some more hints in wiki.openstreetmap.org/wiki/Shapefiles as a page in the OSM wiki. – stephan75 Aug 29 '18 at 19:57
0

Use an online tool on the following website: https://export.hotosm.org

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.