NOTICE: is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum

(converted from )

There still doesn't seem to be any simple way to get a proper Country->Province/State->Place->Street hierarchy out. I need that for the entire US and UK to start.

A highway is an open Way polyline, and the others are closed Way polylines. The only relationship between them known to OSM is geographical, as far as I can tell. Converting this data to an address hierarchy requires a lot of polygon intersection tests to tell what's inside what.

Has anyone built a tool for that? I don't see capabilities for that in osmfilter or osmosis. Loading all that spatial data into an SQL database with spatial indices is possible, but most of those don't do spatial joins very well.

asked 09 Feb '15, 03:53

John_Nagle's gravatar image

accept rate: 0%

converted to question 10 Feb '15, 17:16

stephan75's gravatar image


Have a look at the web service from OSM user Wambacher:

There you have a tree structure of all valid boundary relations on the planet. Can this be an entry point for you?

permanent link

answered 10 Feb '15, 17:18

stephan75's gravatar image

accept rate: 6%


That will fetch the hierarchy for named places, but doesn't do anything with highway/Way info other than display it.

I just want Country->Province/State->Place->Street without the geometry, for the entire US. Calculating that from highway and region geometry is a big job. Someone must have done this already.

(10 Feb '15, 18:17) John_Nagle

When I do this (I do OSM data extraction as a commercial service) I always run a number of more or less manual steps on an osm2pgsql import. Of course you can greatly speed up the osm2pgsql import by only importing the bits you're interested in. The difficult bit is that depending on the country you're running this in, a sizable proportion of streets will not have a full hierarchy (e.g. in the US, will be inside a state but not inside any county or street) - do you then omit them, or assign them to a virtual place called "other", or...?

(10 Feb '15, 19:12) Frederik Ramm ♦

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:


question asked: 09 Feb '15, 03:53

question was seen: 5,172 times

last updated: 10 Feb '15, 19:12

NOTICE: is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum