The shapefile is a common standard for representing geospatial vector data. There are several ways of working with Openstreetmap data and shapefiles.
Developed and regulated by Esri as a (mostly) open specification, the shapefile format spatially describes geometries as either 'points', 'polylines', or 'polygons'. In OpenStreetMap terms these can be considered as 'nodes', 'ways' and 'closed ways', respectively. Each geometry has a set of associated attributes (tags).
The shapefile is in fact a grouping of several files formatted to represent different aspects of geodata:
- .shp — shape format; the feature geometry itself.
- .shx — shape index format; a positional index of the feature geometry to allow seeking forwards and backwards quickly.
- .dbf — attribute format; columnar attributes for each shape, in dBase IV format.
There are also several optional files in the shapefile format. The most significant of these is the .prj file which describes the coordinate system and projection information used. Although not part of the Esri shapefile standard, the .lyr file is often included as it contains specifications of how to display the data (colour, labelling, etc) in ArcGIS software.
- For more info see wikipedia
Obtaining shapefiles from OSM data
- Pre-made shapefile downloads
- download shapefiles created by Geofabrik. Shapefiles with the following tags are provided:
- buildings: osm_id, name, building AS "type" (building=yes as "type"=NULL)
- landuse:osm_id, name, landuse AS "type" (w/o forests, and big MPs missing)
- natural:osm_id, name, natural AS "type" (with forests, and big MPs missing)
- places: osm_id, name, type, population
- points: osm_id, timestamp, name, key AS type
- railways: osm_id, name, railway AS type (w/o highway=* AND railway=tram)
- roads: osm_id, name, ref, highway AS type, oneway, bridge, tunnel, maxspeed
- waterways: osm_id, name, waterway AS type, width (w/o riverbanks/areas)
- download shapefiles from OpenStreetMapData.com. Coastline data only
- The Metro extracts service offers basic shapefiles.
- Services generating custom shapefile downloads
- OSM2GIS - Simple tool developed by User:Arnaud974
- WeoGeo marketplace - Requires registration
- Hot Exports service (export.hotosm.org) (code) - custom export in developing world regions.
- Landcover Database Shapefile Download individual layers not only from OSM by a bounding box.
Create your own shapefiles
- QGIS (qgis.org) - This desktop GIS software has a QGIS OSM Plugin allowing you to open OSM files and save them to shapefile
- note: OSM-Plugin only loads information from 8 keys and cuts values at 82 chars
- "Open Street Map layers importations applications" chapter in Orfeo Toolbox Cookbook, Orfeo Toolbox being available in QGIS through the Sextante plugin.
- If you load OSM data into a PostGIS database using osm2pgsql, then you can use some PostGIS capable GIS software (e.g. those listed below) or run pgsql2shp (feature of PostGIS) to create a shapefile.
- OSMLib - A ruby library which can convert to shapefile following a rules file.
- osm2shp in OSM SVN - C++ script developed by User:Frederik Ramm used by Geofabrik for their shapefile downloads. Fast and scaleable, but maybe not so configurable
- osm2shp in google code - C# conversion utility - Seems to be under development by User:Cipt2001
- osm2shp on github - C++ conversion utility, can read complete planet.osm.gz and planet.osm.bz2 streams directly, support tag filtering, under development by User:minad
- Osmium can convert OSM data to shapefiles. The easiest way is using the included osmjs program which gives you a lot of flexibility in defining what OSM features should end up in what way in the shapefiles.
- Converting OSM to GML - includes follow up information on going from GML to shapefile
- osm2shp Java - A very simple command line tool to convert OSM files to Shapefiles. Written in Java. No input from community on its project page. http://sourceforge.net/scm/?type=svn&group_id=355596
- LocalOsmToShp - To Translate local OpenStreetMap files to shapefiles. Browse C code, documents and examples in project files. Can translate points, ways and relations features, controlling the DBF file (columns and fields). By User:Jrtamayo
- ogr2ogr - ogr2ogr/GDAL 1.10 or newer has support.
Obtaining OSM data from shapefiles
Whilst you may want to convert shapefiles into .osm format for some other reason (e.g. to work with OpenStreetMap related tools) such conversion is normally done as part of an import process. See Import/Shapefile for details.
- Merkaartor has support for reading shapefiles.
- JOSM can load shapefiles with its plugin OpenData.
- Potlatch 2 can display shapefiles as background layer (how-to)
Working with shapefiles
Open Source alternatives include:
- Quantum GIS or QGIS ()
- GRASS GIS ()
- gvSIG Desktop ()
- OpenJUMP ()
- MapWindow GIS 
- udig 
- SAGA GIS 
Other tools and tricks for working shapefiles: