Given I have a relation such as this example. I have installed JOSM and QGIS as well as GDAL tools for the shell. I am aware of Overpass-Turbo. What is the best way to export geometry data from OpenStreetMap into Shapefiles?
If the relation or way in question is closed and tagged with
boundary="political" you might be able to use MapIt: Global for this - it's a reverse geocoder for administrative and political boundary data in OpenStreetMap. (This service is mostly used for looking up enclosing boundaries in OpenStreetMap from a given latitude and longitude, but you can also look up an OpenStreetMap boundary directly from its relation ID or way ID.)
The boundary in your question doesn't have those tags, but for other readers and use cases this might be helpful. For example, for relation 62748 you could construct the URL:
... which redirects to:
If you want to do that programmatically, it's easiest to leave off the
.html from the URL above, to give http://global.mapit.mysociety.org/code/osm_rel/62748 - that redirects to http://global.mapit.mysociety.org/area/979462 and you can just append
.geojson to that latter URL get the GeoJSON version: http://global.mapit.mysociety.org/area/979462.geojson
There are some restrictions to be aware of with this service:
- The database is only updated roughly quarterly, so the relation/way you want might be out of date or missing.
- The only boundaries included are:
- Relations or ways that are closed
- Relations or ways that are either:
- tagged with
- or tagged with
ward(these could be extended for the next import with a pull request modifying this file.
- tagged with