Opened 7 years ago

Last modified 23 months ago

#2497 assigned defect

Handle or ignore postal code

Reported by: ToB Owned by: twain
Priority: major Milestone:
Component: nominatim Version:
Keywords: Cc: mattybe


The namefinder should be able to handle postal codes - at least by ignoring them. Searching for "Neuprüll 17 D-93051 Regensburg" at turns up no place, while taking out the <country-prefix>-<postal-code> (namely "D-93051"), it finds the right spot:

"Results from OpenStreetMap Nominatim: [...] Residential Straße Neuprüll, Stadtbezirk 13, Leoprechting, Regensburg, Regensburg, Stadt, Regierungsbezirk Oberpfalz, Free State of Bavaria, Bundesrepublik Deutschland" (

Note: I do not know whether there was any postal code ("93051") around. I now added it to the Hotel there, which might or might not affect the reproducibility.

Change History (8)

comment:1 Changed 7 years ago by ToB

Actually, I now realize that this might be in part the problem #2497, namely "Places only returned as exact matches". The other problem is that the country prefix for post codes is not supported.

If I search for "12205" it finds "Postcode 12205, Berlin, Bundesrepublik Deutschland" while for "D-12205" nothing is returned.

In any case, I find the new search very useful! It is rather fast and accurate!

comment:2 Changed 7 years ago by twain

  • Owner changed from openstreetmap@… to twain
  • Status changed from new to assigned

comment:3 Changed 4 years ago by stevie_

Hey Twain,

Just wondering what the current status of this issue is?


comment:4 Changed 4 years ago by lonvia

See also: #4964

comment:5 Changed 3 years ago by andersg

Any news on this issue? Any ideas on how to fix it? Maybe some Good Samaritan is willing to help out if pointed in the right direction. ;-)

Edit: After digging around a bit I can see that all but country prefix is working quite well. The issue I have is related to postcodes only mapped on nodes using addr:postcode which don't turn up. Maybe they are not supposed to?

Last edited 3 years ago by andersg (previous) (diff)

comment:6 Changed 2 years ago by lonvia

Regarding addr:postcode on nodes: half the issue is fixed. When showing a result, the tag gets mixed into the result, so that the correct postcode is displayed. What is missing is that Nominatim needs to add the postcode in the search index of the streets they belong to or it won't be able to find addresses containing the postcode. There are some ideas how to do that (basically patching the search index for the street when a house number is found) but it is not clear yet what the performance impact is. So what needs to be done is to do the implementation, add some test-cases to make sure it works as expected and then test the performance impact on some smaller excerpts. If that goes well, I can help out with performance tests on a planet file.

The other issue is that postcodes themselves must be found. Nominatim currently computes centroids over all addr:postcode in the DB and returns these centroids. Problem is that this is naturally a very expensive operation and so the centroids don't get updated and postcodes go stale with time. How to proceed on this issue is less clear. Efficient updates might need a different approach to these postcode centroids than we have today.

If a Good Samaritarian would want to work one any of those two problems, I would recommend they join the IRC channel #osm-nominatim for a more in-depth discussion.

comment:7 Changed 2 years ago by mattybe

  • Cc mattybe added

comment:8 Changed 23 months ago by lonvia

addr:postcodes from addresses are now propagated back into the search index of the street.

Remains the update of postcode centroids.

Note: See TracTickets for help on using tickets.