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

What is the best way to get street name by part of street name and to get list of all building numbers on street. Which software and services need I to install on my own server? I want use it without connection to OSM servers. Is it possible to make it by Overpass Api or by Nominatim? How will queries look for Nominatim, Overpass API and PostgreSQL? Thank you.

asked 13 Jan '15, 10:38

yaahor's gravatar image

accept rate: 0%

edited 14 Jan '15, 12:25

Can you explain what is the level and scale of your needs ? is it just locally or for an application (web, mobile) ? is it just for one town, for a country, the world ?

(14 Jan '15, 12:15) Pieren

It will be used on website. It is for one town (maybe in future for country).

(14 Jan '15, 12:23) yaahor

Then a local instance of nominatim can help you to find the full street name then you can retrieve the data yourself on your local copy of osm dataset. overpass is only usefull when you work online and don't want a local database.

(14 Jan '15, 13:54) Pieren

I thought allow install Overpass API locally. Did I err? I have understood how make my task using Overpass API. Nominatim can help me really? Can you write Nominatim query?

(14 Jan '15, 15:57) yaahor

Normally, you don't need a special software with spacial queries. If the street numbers are correctly tagged, the link between the number and its street is already in OSM. To simplify, currently they are two methods to link the street number of a building to its street (also documented in the wiki) (which method is used is a contributor decision):
- two tags "addr:housenumber=< a number>" + "addr:street=< the street name>" set on the same OSM element, a node or a closed way (a polygon) or a relation (most probably a relation for a multipolygon)
- one tag "addr:housenumber=< a number>" set on the OSM element, node or way like above, and attached to a relation of type "associatedStreet" with the role "house" and where the street name is the relation tag "name". The polyline(s) of the street itself is(are) also member of this relation with the role "street" (see the wiki). So, once you find an OSM node or way with a tag "addr:housenumber", you can check if it is part of a relation "associatedStreet" and get the related street.

Statistically, the second method with a relation is much less popular than the first (less intuitive and newcomers are relunctant to edit/create relations) and is present only on some areas (like in France), this depends on how the method is popularized locally. So basically, if you find a housenumber without one of the two methods listed above, we generally consider this as incomplete in OSM. But sSome people still consider that the street can be linked by the distance between the OSM element and the nearest street (way tagged "highway") but there is a large consensus to consider this as too vague/imprecise and leading to errors especially near intersections- Geofabrik is providing a slippy map, OSM Inspector, showing if the address can be linked to a street and by which method here :

What you should do first is download the OSM data (or some sample) into JOSM and look up how addresses are tagged in your area of interest.

permanent link

answered 14 Jan '15, 09:50

Pieren's gravatar image

accept rate: 15%

edited 14 Jan '15, 11:54

There are many ways to do what you want. One way to load an OSM file into PostGIS with osm2pgsql, and do some geo SQL queries on the results.

permanent link

answered 13 Jan '15, 14:14

rorym's gravatar image

accept rate: 11%

Can you write example of query to DB?

(14 Jan '15, 13:05) yaahor

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: 13 Jan '15, 10:38

question was seen: 7,460 times

last updated: 14 Jan '15, 15:57

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