From OpenStreetMap Wiki
Jump to: navigation, search

The OGR Simple Features Library is a C++ Open Source library (and commandline tools) providing read (and sometimes write) access to a variety of GIS databases and vector file formats. It is related to GDAL, which focuses on raster formats.

The GDAL/OGR library itself has a OGR OSM driver that supports reading OSM XML and PBF files (starting with GDAL 1.10)


ogr2ogr is a utility that comes with the library that can read OSM data and write formats supported by OGR.

Example conversion:

  ogr2ogr -f "ESRI Shapefile" outputdir inputosm.osm

Or to deal with errors:

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


 ogr2ogr -overwrite --config OSM_CONFIG_FILE my_osmconf.ini -skipfailures -f "ESRI Shapefile" charentilly charentilly.osm

Bundling tools

Being a low-level lightweight C++ tool, ogr2ogr converting functions tends to get bundled into other tools, which wrap the functionality in different interfaces. Some of these pre-date the adding of OSM support, and so they used to provide the only interface from OSM data into these other formats (But OSM support has since been included in OGR itself)

  • Osmium - has support for OGR geometries and can be used to build converters from OSM to various GIS databases and file formats.
  • GeoConverter - is an online tool offering some of these conversions
  • QGIS - The desktop GIS software QGIS uses GDAL/OGR too to support many formats. It also provides the GdalTools Plugin, which integrates gdal-tools into QGIS for processing raster data.