Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UK postcodes missing #980

Closed
stevewolfe555 opened this issue Mar 19, 2018 · 17 comments
Closed

UK postcodes missing #980

stevewolfe555 opened this issue Mar 19, 2018 · 17 comments

Comments

@stevewolfe555
Copy link

Hello,

This might be lack of understanding but should Nominatim be able to find any UK postcode via a search of it?

When I search "en10 6ad" after running the British isles install I get no results.

search.php?q=en10+6ad&polygon_geojson=1&viewbox=

But when I search other postcodes I get results, its seems to have about a 50% hit rate..

@JensHumrich
Copy link

Using the normal search
https://www.openstreetmap.org/search?query=en10 6ad
leads to one result:
Postleitzahl Broxbourne, EN10 6AD, Vereinigtes Königreich
But I am unable to click on this result or edit it :(

@stevewolfe555
Copy link
Author

Its the local install i am having issues with.

@mtmail
Copy link
Collaborator

mtmail commented Mar 21, 2018

@stevewolfe555 Can you check if it's an issue with spaces in the query? #927 Nominatim 3.1 has a more generic postcode handling than 3.0 and some special logic for GB postcodes was removed.

Nominatim queries two sources: one is OpenStreetMap, tough of course only a fraction of addresses/businesses have a full postcode attached, the second is Ordnance Survey (postcode file on http://nominatim.org/).

@JensHumrich What you see is results from the latter. We get the location from the postcode file but there's no OSM object and instead of returning a nearby it ends up un-clickable on
https://www.openstreetmap.org/search?query=en10%206ad On https://nominatim.openstreetmap.org/search.php?q=en10+6ad the 'details' link is misleading because it does show a OSM object.

I'll check where the GB postcode logic got lost.

@stevewolfe555
Copy link
Author

@mtmail are you also saying it will only work for business postcodes?

Or will it work for residential

@mtmail
Copy link
Collaborator

mtmail commented Mar 21, 2018

The Ordnance Survey contains all GB postcodes, 1.7 million. The issue is that Nominatim doesn't handle the space correctly. So
https://nominatim.openstreetmap.org/search.php?q=en10+6ad
work, but
https://nominatim.openstreetmap.org/search.php?q=en106ad
doesn't.

Do you see that pattern in the postcodes you tried?

@stevewolfe555
Copy link
Author

@mtmail
Copy link
Collaborator

mtmail commented Mar 21, 2018

GB postcodes are optional during the http://nominatim.org/release-docs/latest/admin/Import-and-Update/

Check if they got imported into the location_postcode table.

 country_code |  count
--------------+---------
 gb           | 1702551
 nl           |  464421
 us           |   58003
 ca           |   39958
 br           |   27279

If not then it should be possible to import them now:

  1. download and extract the file from http://nominatim.org/
  2. import into the gb_postcode table, e.g. cat <file> | psql nominatim
  3. run build/utils/setup.php --calculate-postcodes
  4. check counts in location_postcode again

@stevewolfe555
Copy link
Author

I'll run the update again and see what I get.

@stevewolfe555
Copy link
Author

Okay re did the install and got this.

Summary of warnings:

  • external UK postcode table not found.
  • wikipedia article dump file not found - places will have default importance
  • wikipedia redirect dump file not found - some place importance values may be missing

I downloaded the files was I meant to tell it I had?

@mtmail
Copy link
Collaborator

mtmail commented Mar 22, 2018

Do you remember where you downloaded them to? The setup.php looks in

if (file_exists(CONST_BasePath.'/data/gb_postcode_data.sql.gz')) {

and CONST_BasePath is something like Nominatim. In the same directory where you'd also see a us_postcode.sql file. Or maybe you extracted the files after download? http://nominatim.org/release-docs/latest/admin/Import-and-Update/#uk-postcodes

My instructions above (#980 (comment)) should still work to add the GB postcode data manually after an existing install. It uses temporary tables so you can run that even during production.

Adding wikipedia ranking data after an install isn't possible I'm afraid. That would need a full reimport of the data. http://nominatim.org/release-docs/latest/admin/Import-and-Update/#wikipedia-rankings

@stevewolfe555
Copy link
Author

That file was there, this is what i dont understand. All the files where in the correct DIR.

Could you give more detail as to this.

import into the gb_postcode table, e.g. cat | psql nominatim
run build/utils/setup.php --calculate-postcodes
check counts in location_postcode again

@mtmail
Copy link
Collaborator

mtmail commented Mar 22, 2018

Assuming you have Nominatim installed on /srv/nominatim/Nominatim and the build directory in /srv/nominatim/build/ (that's the default in the Ubuntu16 instructions, but you might have those in another's user home directory which is fine).

  1. login as the user who installed Nominatim. For example sudo su nominatim
  2. This imports the *.sql file into the database zcat /srv/nominatim/Nominatim/data/gb_postcode_data.sql.gz | psql nominatim
  3. uses data from the gb_postcode table and rewrites the location_postcode table cd /srv/nominatim/build/; utils/setup.php --calculate-postcodes
  4. login to postgresql psql nominatim
  5. run the SQL query select count(*) from location_postcode where country_code='gb';. It should say 1.7 million

@stevewolfe555
Copy link
Author

stevewolfe555 commented Mar 23, 2018 via email

@stevewolfe555
Copy link
Author

Hi I have been running utils/setup.php --calculate-postcodes for 20 + hours now and its still not completing.

is there any logs i can tail to see whats going on?

The server is a 8cpu 32gb ssd

@mtmail
Copy link
Collaborator

mtmail commented Mar 24, 2018

That's a surprising long time. It runs https://github.com/openstreetmap/Nominatim/blob/master/sql/update-postcodes.sql so you could check for the size of the temporary tables.

@stevewolfe555
Copy link
Author

I dropped the DB and am rebuilding it after making sure all data files where there.

See how it goes this time.

@stevewolfe555
Copy link
Author

Seems too be all working now thanks guys.

@lonvia lonvia closed this as completed Mar 24, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants