I'm trying to use Nominatim to get the Lat/Long for GB Postcodes and struggling. To avoid pounding on OpenStreetMaps's servers I've setup my own Nominatim with the gb_postcode_data but it doesn't seem to get used.

If I query like so:

wget -O - -q "http://mynominatim.somewhere/search?format=xml&postalcode=KA2 9AE&country=gb"

I get no result (same result if I use nominatim.openstreetmap.org for the above query).

wget -O - -q "http://mynominatim.somewhere/search?format=xml&postcode=KA2 9AE&country=gb"

I get no result (using nominatim.openstreetmap.org I get a place in the Lake District returned).

wget -O - -q "http://mynominatim.somewhere/search?format=xml&q=KA2 9AE&country=gb"

Returns a place in Wales but the KA2 9AE postcode is in Dundonald, Scotland (the same query on nominatim.openstreetmap.org returns no result). However using "PE8 6XH" as the postcode in the above query I get sensible results from both the official and my nominatim. Huh?

I've checked and "KA2 9AE" is in the gb_postcode_data.sql.gz file so why's it not being used? Why the different results from 'my' nominatim and the official one?

I'm probably doing something stupid but I can't work out what. Enlightenment would be greatly appreciated.

asked 14 Jan '15, 11:36

ruffle's gravatar image

ruffle
26112
accept rate: 0%

The result you are getting for the 2nd query is simply the centroid for the GB admin boundary polygon. What I know about nominatim the postcode support is minimal and likely you should be asking the developers directly (aka opening an issue).

(14 Jan '15, 14:07) SimonPoole ♦

Thanks for the advice, new issue opened:

https://github.com/twain47/Nominatim/issues/221

When I get an answered I'll update this page.

(14 Jan '15, 17:09) ruffle

If you just want postcode centroids, then Nominatim is probably not the best tool for the job. You can download the centroids for free from Ordnance Survey's OpenData initiative, which will be much more complete than the equivalent data in OSM.

permanent link

answered 14 Jan '15, 18:22

Richard's gravatar image

Richard ♦
30.5k44274408
accept rate: 19%

Your answer
toggle preview

Follow this question

By Email:

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

By RSS:

Answers

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:

×15
×14
×6

question asked: 14 Jan '15, 11:36

question was seen: 2,862 times

last updated: 14 Jan '15, 18:22

powered by OSQA