Bulk UK Postcode format fixing

Currently there are are nearly 400 errors in the town of Lymington Nominatim QA Tool each without a space (I haven’t checked them all).
Since UK postcodes must use upper case letters and have a space immediately before the last digit, could someone (point me at how to) make bulk database update to fix these ?

Is it worth adding a bot which corrects format errors in UK Postcodes ?
Could anyone suggest any similar bots that we could copy ?

describes the exact format of UK Postcodes.

The policy for this is here.

1 Like

I’m often the person who fixes those. I check the Nominatim QA tool regularly for Europe. In UK and Nederlands spaces and uppercasing are the most common mistakes users make. Compared to missing a digit, having one digit too much, 0 vs O, or putting house numbers or city name in the postcode field.

For a small area, here it’s one neighborhood, I usually use a Overpass API plus level0 editor.

  1. overpass turbo Ideally with the exact (wrong) postcode but in this case it’s multiple so I’d query all

  2. Click on ‘Data’ instead of ‘Map’ shows the relevant objects. But it’s not formatted nicely. I change the [out:json] in the query to [out:csv(::type,::id)] and run it again

  3. Now I see a list

@type	@id
way	161881012
way	161881013
way	712133694
way	712133695
way	712133696
way	712133697
way	712133698
  1. Using my favorite editor I change the list into a comma separated one line
w161881012,w161881013,w712133694,w712133695,w712133696,w712133697,w712133698
  1. Open the level0 editor http://level0.osmz.ru/ , login and add it to query field, click 'add to editor`

  1. now I make the changes relatively fast

In total this takes me about 5 minutes because I’ve used those tools for years. I’m not doing the steps now in case you want to try them.

Like I said I regularly cleanup European postcodes so eventually I would encounter the Lymington ones again.

I ended up using iD editor and the shift-key to select multiple buildings. The UK QA map looks cleaner now Nominatim QA Tool

Most remaining warnings are roads with incomplete postal_code set (last digit missing). If all buildings left and right have their full post set then I remove that. If not then it might be enough of valuable information, even though roads rarely receive mail.

My long-term plan is to write a iD editor validation plugin which warns users and offers suggestions. I have written a validation plugin last year for name vs noname issues.

1 Like

In anyone’s interested, one of my tools does some slightly more detailed checking of UK postcodes, including validation against the official Code-Point Open list. The data is updated roughly weekly, and the results can be seen at https://osm.mathmos.net/addresses/pc-errors.html.

1 Like