Skip to main content

Improving the postcode matching on GOV.UK

Posted by: , Posted on: - Categories: How we work, Product changes

We’ve just finished improving the application we use on GOV.UK for postcode matching. It’s used to give a result for ‘local transactions’ and ‘find my nearest’ formats.

Local transactions help users find services and content that are provided by their local authority. For example, users may need to pay their council tax, report noise pollution or find out when their rubbish is collected.

Find my nearests help users find the closest place to them for a particular thing. For example, users may need to find their nearest register office or number plate supplier.

Both these formats rely on GOV.UK’s installation of MapIt, an open source application made by mySociety, which matches a postcode to a geographical area or Local Authority. By matching the postcode to the correct area or Local Authority, we’re then able to give the user a relevant result.

What the problem was

We could see from the feedback left by users that some people had entered a valid postcode but didn’t get a result because we didn’t recognise their postcode. This was particularly a problem for users who had recently moved into a property with a new postcode.

The underlying problem was that we hadn’t been supporting our installation of MapIt in the same way we support other GOV.UK applications. It was more difficult than it should’ve been to update our postcode dataset when a newer one is released. This meant we were using out of date postcode data and some users weren’t getting a result at all.

What we did

1. We started using the latest Office for National Statistics (ONS) postcode dataset so that we have a better coverage of postcodes when users enter a postcode on our pages.

This has substantially reduced the number of times that we don’t recognise valid postcodes. From tracking the error messages we show to users when we can’t match their postcode, we know that updating the data has halved the error rate.

2. We started using the latest ONS data for Local Authority boundaries. This means that users searching by postcode are more likely to get the correct result for a Local Authority, particularly for postcodes close to the boundary.

3. We have a better understanding of Northern Ireland Local Authorities and their boundaries since they were reformed and redrawn in 2015. Although we aren’t yet able to support Northern Ireland local transactions at the moment, this makes it easier for us to do so in the future.

4. We improved the way we support our installation of MapIt by:

  • using the most up to date versions of the software it depends on eg Ubuntu (the operating system), PostgreSQL (the database server software) and Django (the application framework)
  • making it work in a similar way to our other GOV.UK applications, so it's easier for us to support
  • making it easier to use new postcode and boundary data when they are released
  • making it possible to run MapIt in a preview environment so that we can test changes more easily
  • contributing changes back to mySociety so that others can benefit from the work we’ve done eg and

What’s next

Because of the work we’ve done, it’s much easier for us to use the latest ONS postcode data whenever a new dataset is released. So we’ll keep our eye out for updates and use the latest postcode data whenever a new version is released. This should ensure the postcode data we’re using doesn’t get as out of date again - tracking when we don’t recognise the postcode a user has entered will help us to monitor this. There's a separate blog post about how we're tracking errors for local transactions on GOV.UK.

Now that we’re happier with how we’re supporting our installation of MapIt, we’re focussing on our next mission to improve how users find services and content provided by Local Authorities. We’ll blog about this in the coming weeks so that you can see what we’re doing.

Mark Mcleod is the product manager for the Custom Formats team. You can follow Mark on Twitter.

Subscribe to Inside GOV.UK to keep up to date with our work

GDS is hiring

Sharing and comments

Share this page

1 comment

  1. Comment by Vicky Sargent posted on

    Good to hear about this work and looking forward to further developments on the hand off from GOV.UK to services and content provided by local authorities, including arrangements for broken links as we discussed a couple of months back. Anyone who wants to see how councils in their area perform on delivery of information and services can visit to see headline results for all 416 local authority websites as well as a range of contextual information.