Can I overlay Boundary-Line data onto OpenStreetMap and extract streetnames?

The Ordnance Survey produces map data for UK election areas ranging from parliamentary constituencies down to the local council electoral districts (which are where polling stations will be located). The data, known as Boundary-Line, is provided under the UK’s OpenData license making it freely downloadable for anyone to use. I would like to put this to good use by overlaying this information onto OpenStreetMap and then, if possible, extracting road names within particular electoral districts. Currently OpenStreetMap only has the boundaries of council areas marked but I want this finer granularity.

Begs two questions. Firstly is it possible to extract streetname within a bounded area in OpenStreetMap? If that is possible, either with an Export or use of some API, the second question becomes is it possible to overlay the Boundary-Line data on the map to provide the limits of that bounded area? If it cannot be done directly with OpenStreetMap might it be possible by using QGIS?

I search the forums here for anything similar but found nothing. Also looked for Boundary-Line which also had nothing.

Boundary-Line data is offered in these formats: Vector Tile, GeoPackage, ESRI Shapefile, GML and MapInfo TAB.

You can do this in a number of ways:

  • Convert the particular boundary into a form understood by overpass as a polygon filter. This is probably: a bit cumbersome; and, likely to have performance issues.
  • Generate a bounding box for the boundary & use this in Overpass to get all streets within the bounding box. Save as Geojson and manipulate on the PC. The basic query may be close enough to what you want.
  • Download streets within the bounding box within QGIS, clip the result set with the boundary

Basically it’s probably hard to combine operations in a single step: so think of the problem as two step: 1. getting streets in a bounding box; and 2 clipping those to the precise polygon of the boundary area. For 1. use Overpass or Overpass-turbo; for 2. use QGIS or ogr2ogr (if you require a toolchain). Longer term, if doing this frequently I’d use PostGIS.

PS. A very nice solution would be Overpass allowed additional data to be loaded alongside OSM data, to provide access to additional polygons such as these.

Thanks for the idea. Cumbersome and (personal) performance issues are not really a factor as this is something I only want to do once. The polygon data is provided in exact form and very little I can do to simplify it as they abutt other bounded areas that are likely of interest too. I would rather get the street names out with as little intervention from me.

Overpass looks interesting if somewhat arcane in its syntax and with an API I could put it in a script just in case I need to use it for those adjacent areas.

If you want scripting you can use an overpass query (e.g., built in the browser & saved in a format suitable for scripting, which is an option in Overpass-turbo) & then ogr2ogr to do the clipping. ogr2ogr is probably even more inscrutable than overpass.

One thing I overlooked is that you will need a fairly complex query for streets because you cannot just do way[highway]{{bbox}}. You will need to filter for all motorable roads (motorway, trunk, primary, secondary, tertiary, unclassified, and residential). You also need _link roads of the first 3 or 4, and possibly highway=pedestrian for inner-city pedestrian precincts.