I've installed my own Nominatim instance with the Netherlands database.

In the Netherlands it is possible to lookup a street address by entering a house number and postcode. You can verify this at http://postcode.nl by entering the postcode 9718ES and the house number 24, which will return "Melkweg" as the street name.

In fact, in most cases it is possible to get the street address just from the postcode (without a house number). This is also possible at postcode.nl.

Nominatim also has this data. E.g. when you search for Melkweg 24 the correct postcode 9718ES is returned. However, when you do a lookup like ?q=9718ES 24 or ?street=24&postcode=9718ES nothing is returned.

Is it possible to perform this lookup with Nominatim, or perhaps Nominatim can be altered to include such logic?

asked 16 Jun '14, 15:05

TomM's gravatar image

accept rate: 0%

No this is currently not possible. Postcode systems the world over are all very different and nobody has yet taken the effort to create the code so Nominatim can understand all those systems. There is some generic support for postcodes, but it is very limited.

On top of that Nominatim doesn't really index the address nodes. It indexes the streets (and selected POI's) and then connects the address nodes to the nearby streets with the same name. For the Netherlands the effect of this is, that the only part of the postcode that is in the index are the four numbers. This is however imprecise (and probably incomplete) as this is based on nodes with a certain tag and not on boundaries.

permanent link

answered 16 Jun '14, 15:37

cartinus's gravatar image

accept rate: 27%

Do you mean that Nominatim never includes the "ES" of the postcode when I search for "9718ES"? If this is the case, how come Nominatim does return "9718ES" when I search for the street address, rather than just "9718"? I would like to patch Nominatim to allow for postcode lookups in the Netherlands (I already forked it), but I have no clue on how its geocoding algorithm currently works. I tried to grasp it in Geocode.php but find it somewhat difficult to understand.

(16 Jun '14, 17:15) TomM

There are nodes with the tag "postal_code". This has in the Netherlands mostly only the 4PP code. Until recently this was basically the only postcode data around here. Now with the BAG data in OSM we have lots of nodes (and ways) with the tag "addr:postcode". However these are only seen as a postcode POI for the indexing when they are included for another reason. E.g. because they are put on an ATM.

If you search with a housenumber (Melkweg 34, Hellevoetsluis) it notices the addr:postcode on the end result and decides that is better (because explicitly tagged) than the guestimate. Notice the greyed out guestimate and the fact the used postcode has no ID in the index.

On top of all this there is the search string parser. How should it know what is a postcode in the following string: "Melkweg 34 3225VE Hellevoetsluis". It's immediately obvious for a Dutchman, but for a computer it could equally be just a long housenumber.

Sorry, I can't help you with the coding.

(16 Jun '14, 18:21) cartinus

It's been two years, the "No this is currently not possible." is still correct?

(06 Oct '16, 13:17) lucas_steffen

It's been seven years. Unfortunately it still isn't possible.

@cartinus, it can be immediately obvious for a computer too. Four digits followed by two letters can only be a postcode, in the Netherlands. So with RegEx it shouldn't be a problem.

For example:

// This will return the postcode IF the address string contains one, IF not it will return an empty string

$address_string = "Melkweg 34 3225VE Hellevoetsluis";

$postcode = preg_match("/\d\d\d\d[a-z][a-z]/i", $address_string, $matches) ? $matches[0] : "";

echo $postcode;

The only thing left to do is check if the address country is the Netherlands. Nominatim already seems to be able to do this with just the postcode.

Therefor it's only a matter of implementing it. The code exists, it works, it only needs someone who knows Nominatim to add it.

If you're that someone, please add this option, it would be incredibly useful to us.

(18 Oct, 21:17) WebDev_21

@WebDev_21 you obviously have little idea how OSM software develops, or the resources available to do it. No-one is going to drop everything to implement an obscure tweak just for The Netherlands. Either fork the project and do it yourself submitting a pull request for it to be pulled back into core, or pay someone to do it. Don't tell volunteers "it's only a matter of implementing it", the same is true of nuclear fusion!

(18 Oct, 22:21) SK53 ♦
Your answer
toggle preview

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](http://url.com/ "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: 16 Jun '14, 15:05

question was seen: 15,817 times

last updated: 18 Oct, 22:21

powered by OSQA