Repository: DFE-Digital/bat-design-history
Pull request #1527: Add post: Geocoding addresses
Author: login: simonwhatley
Created: 2025-03-20T12:54:19Z | Merged: 2025-03-25T12:26:49Z

See post: [Geocoding addresses](https://deploy-preview-1527--bat-design-history.netlify.app/register-of-training-providers/geocoding-addresses/)


Diff:
diff --git a/app/images/register-of-training-providers/geocoding-addresses/add-address--check-your-answers-no-geolocation.png b/app/images/register-of-training-providers/geocoding-addresses/add-address--check-your-answers-no-geolocation.png
new file mode 100644
index 000000000..708cbefe8
Binary files /dev/null and b/app/images/register-of-training-providers/geocoding-addresses/add-address--check-your-answers-no-geolocation.png differ
diff --git a/app/images/register-of-training-providers/geocoding-addresses/add-address--check-your-answers.png b/app/images/register-of-training-providers/geocoding-addresses/add-address--check-your-answers.png
new file mode 100644
index 000000000..5717340b5
Binary files /dev/null and b/app/images/register-of-training-providers/geocoding-addresses/add-address--check-your-answers.png differ
diff --git a/app/images/register-of-training-providers/geocoding-addresses/add-provider--check-your-answers.png b/app/images/register-of-training-providers/geocoding-addresses/add-provider--check-your-answers.png
new file mode 100644
index 000000000..7bdef4bfe
Binary files /dev/null and b/app/images/register-of-training-providers/geocoding-addresses/add-provider--check-your-answers.png differ
diff --git a/app/images/register-of-training-providers/geocoding-addresses/provider-details.png b/app/images/register-of-training-providers/geocoding-addresses/provider-details.png
new file mode 100644
index 000000000..2fbb26c4a
Binary files /dev/null and b/app/images/register-of-training-providers/geocoding-addresses/provider-details.png differ
diff --git a/app/posts/register-of-training-providers/2025-02-24-geocoding-addresses.md b/app/posts/register-of-training-providers/2025-02-24-geocoding-addresses.md
new file mode 100644
index 000000000..f27638243
--- /dev/null
+++ b/app/posts/register-of-training-providers/2025-02-24-geocoding-addresses.md
@@ -0,0 +1,79 @@
+---
+title: Geocoding addresses
+description: We geocode addresses so users can quickly find and choose training providers based on accurate location data
+date: 2025-02-24
+tags:
+  - addresses
+  - locations
+  - geocoding
+related:
+  items:
+    - text: Managing provider addresses
+      href: /register-of-training-providers/managing-provider-addresses/
+    - text: Adding an address using a postcode address finder
+      href: /register-of-training-providers/adding-an-address-using-a-postcode-address-finder/
+    - text: Using a postcode address finder in the new provider flow
+      href: /register-of-training-providers/using-a-postcode-address-finder-in-the-new-provider-flow/
+screenshots:
+  items:
+    - text: Add provider - check your answers
+      src: add-provider--check-your-answers.png
+    - text: Add address - check your answers
+      src: add-address--check-your-answers.png
+    - text: Add address - check your answers with no geolocation information
+      src: add-address--check-your-answers-no-geolocation.png
+    - text: Provider details
+      src: provider-details.png
+---
+
+Previously, we gave users the ability to [manage provider addresses](/register-of-training-providers/managing-provider-addresses/) and [add an address using a postcode address finder](/register-of-training-providers/adding-an-address-using-a-postcode-address-finder/). This work enables us to collect accurate and reliable address data.
+
+To increase the utility of the address data, we need to geocode addresses as well.
+
+We geocode addresses because it:
+
+- allows users to quickly find and choose training providers based on accurate location data - for example, on Find postgraduate teacher training (Find)
+- enables spatial mapping, regional planning, and identification of coverage gaps or oversupply areas, informing strategic decision-making
+- helps identify geographic trends and target resources, support, or funding more effectively to regions with specific needs or opportunities
+
+We use the Ordnance Survey (OS) Places API in our postcode address finder, but it does not include geolocation (latitude and longitude) data. Furthermore, geolocation data will not be included by default if a user manually enters an address.
+
+To solve this problem, we use the Google Maps API.
+
+## What we did
+
+We updated the ‘Add provider’ and ‘Add address’ flows to automatically geocode the address data before saving it to the database.
+
+We display the latitude and longitude data on the:
+
+- add provider flow ‘Check your answers’ page
+- add address flow ‘Check your answers’ page
+- address summary card on the provider details page
+
+## How it works
+
+Once the user has selected or entered the address, we send the address string to the Google Maps API. The API returns the latitude and longitude, which we display in a summary list to the user.
+
+The geolocation summary list contains two rows:
+
+- latitude
+- longitude
+
+We display the whole latitude and longitude data returned by the API; we do not round it.
+
+Users cannot change the latitude or longitude directly. Instead, they need to change the address.
+
+If the API returns no geolocation data, we replace the summary list with a message:
+
+> The address could not be geocoded.
+
+We save the geolocation data against each address for later recall.
+
+## Further considerations
+
+We considered allowing users to add geolocation data if the API fails. However, we decided against doing so as we could not guarantee that the information entered by the user would be correct or match the address, and we did not want to increase the complexity by introducing a mechanism to double-check the data.
+
+Instead, we can introduce a background process that periodically checks addresses with missing geolocation data and attempts to fill in the gaps.
+
+*[API]: application programming interface
+*[OS]: Ordnance Survey


Reviews:
user: login: olioldfield
body: Love it
state: APPROVED
author_association: CONTRIBUTOR
submitted_at: 2025-03-24T14:33:54Z
user: login: defong
state: APPROVED
author_association: CONTRIBUTOR
submitted_at: 2025-03-24T15:56:38Z
user: login: simonwhatley
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-03-24T16:15:19Z
user: login: tomtrentham
state: APPROVED
author_association: CONTRIBUTOR
submitted_at: 2025-03-25T12:19:06Z
user: login: simonwhatley
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-03-25T12:26:09Z

Review comments:
diff_hunk: @@ -0,0 +1,79 @@
+---
+title: Geocoding addresses
+description: We geocode addresses so users can quickly find and choose training providers based on accurate location data
+date: 2025-02-24
+tags:
+  - addresses
+  - locations
+  - geocoding
+related:
+  items:
+    - text: Managing provider addresses
+      href: /register-of-training-providers/managing-provider-addresses/
+    - text: Adding an address using a postcode address finder
+      href: /register-of-training-providers/adding-an-address-using-a-postcode-address-finder/
+    - text: Using a postcode address finder in the new provider flow
+      href: /register-of-training-providers/using-a-postcode-address-finder-in-the-new-provider-flow/
+screenshots:
+  items:
+    - text: Add provider - check your answers
+      src: add-provider--check-your-answers.png
+    - text: Add address - check your answers
+      src: add-address--check-your-answers.png
+    - text: Add address - check your answers with no geolocation information
+      src: add-address--check-your-answers-no-geolocation.png
+    - text: Provider details
+      src: provider-details.png
+---
+
+Previously, we gave users the ability to [manage provider addresses](/register-of-training-providers/managing-provider-addresses/) and [add an address using a postcode address finder](/register-of-training-providers/adding-an-address-using-a-postcode-address-finder/). This work enables us to collect accurate and reliable address data.
+
+To increase the utility of the address data, we need to geocode addresses as well.
+
+We geocode addresses because it:
+
+- allows users to quickly find and choose training providers based on accurate location data - for example, on Find postgraduate teacher training (Find)
+- enables spatial mapping, regional planning, and identification of coverage gaps or oversupply areas, informing strategic decision-making
+- helps identify geographic trends and target resources, support, or funding more effectively to regions with specific needs or opportunities
path: app/posts/register-of-training-providers/2025-02-24-geocoding-addresses.md
user: login: defong
body: Feels like an awesome :brain: stormer
created_at: 2025-03-24T15:50:07Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,79 @@
+---
+title: Geocoding addresses
+description: We geocode addresses so users can quickly find and choose training providers based on accurate location data
+date: 2025-02-24
+tags:
+  - addresses
+  - locations
+  - geocoding
+related:
+  items:
+    - text: Managing provider addresses
+      href: /register-of-training-providers/managing-provider-addresses/
+    - text: Adding an address using a postcode address finder
+      href: /register-of-training-providers/adding-an-address-using-a-postcode-address-finder/
+    - text: Using a postcode address finder in the new provider flow
+      href: /register-of-training-providers/using-a-postcode-address-finder-in-the-new-provider-flow/
+screenshots:
+  items:
+    - text: Add provider - check your answers
+      src: add-provider--check-your-answers.png
+    - text: Add address - check your answers
+      src: add-address--check-your-answers.png
+    - text: Add address - check your answers with no geolocation information
+      src: add-address--check-your-answers-no-geolocation.png
+    - text: Provider details
+      src: provider-details.png
+---
+
+Previously, we gave users the ability to [manage provider addresses](/register-of-training-providers/managing-provider-addresses/) and [add an address using a postcode address finder](/register-of-training-providers/adding-an-address-using-a-postcode-address-finder/). This work enables us to collect accurate and reliable address data.
+
+To increase the utility of the address data, we need to geocode addresses as well.
+
+We geocode addresses because it:
+
+- allows users to quickly find and choose training providers based on accurate location data - for example, on Find postgraduate teacher training (Find)
+- enables spatial mapping, regional planning, and identification of coverage gaps or oversupply areas, informing strategic decision-making
+- helps identify geographic trends and target resources, support, or funding more effectively to regions with specific needs or opportunities
+
+We use the Ordnance Survey (OS) Places API in our postcode address finder, but it does not include geolocation (latitude and longitude) data. Furthermore, geolocation data will not be included by default if a user manually enters an address.
+
+To solve this problem, we use the Google Maps API.
+
+## What we did
+
+We updated the ‘Add provider’ and ‘Add address’ flows to automatically geocode the address data before saving it to the database.
+
+We display the latitude and longitude data on the:
path: app/posts/register-of-training-providers/2025-02-24-geocoding-addresses.md
user: login: defong
body: Does it actually have any benefits?

It not like 51.454014	-0.410282 that is worldly recognisable :thinking: 
created_at: 2025-03-24T15:54:57Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,79 @@
+---
+title: Geocoding addresses
+description: We geocode addresses so users can quickly find and choose training providers based on accurate location data
+date: 2025-02-24
+tags:
+  - addresses
+  - locations
+  - geocoding
+related:
+  items:
+    - text: Managing provider addresses
+      href: /register-of-training-providers/managing-provider-addresses/
+    - text: Adding an address using a postcode address finder
+      href: /register-of-training-providers/adding-an-address-using-a-postcode-address-finder/
+    - text: Using a postcode address finder in the new provider flow
+      href: /register-of-training-providers/using-a-postcode-address-finder-in-the-new-provider-flow/
+screenshots:
+  items:
+    - text: Add provider - check your answers
+      src: add-provider--check-your-answers.png
+    - text: Add address - check your answers
+      src: add-address--check-your-answers.png
+    - text: Add address - check your answers with no geolocation information
+      src: add-address--check-your-answers-no-geolocation.png
+    - text: Provider details
+      src: provider-details.png
+---
+
+Previously, we gave users the ability to [manage provider addresses](/register-of-training-providers/managing-provider-addresses/) and [add an address using a postcode address finder](/register-of-training-providers/adding-an-address-using-a-postcode-address-finder/). This work enables us to collect accurate and reliable address data.
+
+To increase the utility of the address data, we need to geocode addresses as well.
+
+We geocode addresses because it:
+
+- allows users to quickly find and choose training providers based on accurate location data - for example, on Find postgraduate teacher training (Find)
+- enables spatial mapping, regional planning, and identification of coverage gaps or oversupply areas, informing strategic decision-making
+- helps identify geographic trends and target resources, support, or funding more effectively to regions with specific needs or opportunities
+
+We use the Ordnance Survey (OS) Places API in our postcode address finder, but it does not include geolocation (latitude and longitude) data. Furthermore, geolocation data will not be included by default if a user manually enters an address.
+
+To solve this problem, we use the Google Maps API.
+
+## What we did
+
+We updated the ‘Add provider’ and ‘Add address’ flows to automatically geocode the address data before saving it to the database.
+
+We display the latitude and longitude data on the:
+
+- add provider flow ‘Check your answers’ page
+- add address flow ‘Check your answers’ page
+- address summary card on the provider details page
+
+## How it works
+
+Once the user has selected or entered the address, we send the address string to the Google Maps API. The API returns the latitude and longitude, which we display in a summary list to the user.
+
+The geolocation summary list contains two rows:
+
+- latitude
+- longitude
+
+We display the whole latitude and longitude data returned by the API; we do not round it.
path: app/posts/register-of-training-providers/2025-02-24-geocoding-addresses.md
user: login: defong
body: Can we be nicer and have a map?
created_at: 2025-03-24T15:56:08Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,79 @@
+---
+title: Geocoding addresses
+description: We geocode addresses so users can quickly find and choose training providers based on accurate location data
+date: 2025-02-24
+tags:
+  - addresses
+  - locations
+  - geocoding
+related:
+  items:
+    - text: Managing provider addresses
+      href: /register-of-training-providers/managing-provider-addresses/
+    - text: Adding an address using a postcode address finder
+      href: /register-of-training-providers/adding-an-address-using-a-postcode-address-finder/
+    - text: Using a postcode address finder in the new provider flow
+      href: /register-of-training-providers/using-a-postcode-address-finder-in-the-new-provider-flow/
+screenshots:
+  items:
+    - text: Add provider - check your answers
+      src: add-provider--check-your-answers.png
+    - text: Add address - check your answers
+      src: add-address--check-your-answers.png
+    - text: Add address - check your answers with no geolocation information
+      src: add-address--check-your-answers-no-geolocation.png
+    - text: Provider details
+      src: provider-details.png
+---
+
+Previously, we gave users the ability to [manage provider addresses](/register-of-training-providers/managing-provider-addresses/) and [add an address using a postcode address finder](/register-of-training-providers/adding-an-address-using-a-postcode-address-finder/). This work enables us to collect accurate and reliable address data.
+
+To increase the utility of the address data, we need to geocode addresses as well.
+
+We geocode addresses because it:
+
+- allows users to quickly find and choose training providers based on accurate location data - for example, on Find postgraduate teacher training (Find)
+- enables spatial mapping, regional planning, and identification of coverage gaps or oversupply areas, informing strategic decision-making
+- helps identify geographic trends and target resources, support, or funding more effectively to regions with specific needs or opportunities
+
+We use the Ordnance Survey (OS) Places API in our postcode address finder, but it does not include geolocation (latitude and longitude) data. Furthermore, geolocation data will not be included by default if a user manually enters an address.
+
+To solve this problem, we use the Google Maps API.
+
+## What we did
+
+We updated the ‘Add provider’ and ‘Add address’ flows to automatically geocode the address data before saving it to the database.
+
+We display the latitude and longitude data on the:
path: app/posts/register-of-training-providers/2025-02-24-geocoding-addresses.md
user: login: simonwhatley
body: I read that as, "Can we have What Three Words?"

No! We do not have a user need for WTW. 
created_at: 2025-03-24T16:15:19Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,79 @@
+---
+title: Geocoding addresses
+description: We geocode addresses so users can quickly find and choose training providers based on accurate location data
+date: 2025-02-24
+tags:
+  - addresses
+  - locations
+  - geocoding
+related:
+  items:
+    - text: Managing provider addresses
+      href: /register-of-training-providers/managing-provider-addresses/
+    - text: Adding an address using a postcode address finder
+      href: /register-of-training-providers/adding-an-address-using-a-postcode-address-finder/
+    - text: Using a postcode address finder in the new provider flow
+      href: /register-of-training-providers/using-a-postcode-address-finder-in-the-new-provider-flow/
+screenshots:
+  items:
+    - text: Add provider - check your answers
+      src: add-provider--check-your-answers.png
+    - text: Add address - check your answers
+      src: add-address--check-your-answers.png
+    - text: Add address - check your answers with no geolocation information
+      src: add-address--check-your-answers-no-geolocation.png
+    - text: Provider details
+      src: provider-details.png
+---
+
+Previously, we gave users the ability to [manage provider addresses](/register-of-training-providers/managing-provider-addresses/) and [add an address using a postcode address finder](/register-of-training-providers/adding-an-address-using-a-postcode-address-finder/). This work enables us to collect accurate and reliable address data.
+
+To increase the utility of the address data, we need to geocode addresses as well.
+
+We geocode addresses because it:
+
+- allows users to quickly find and choose training providers based on accurate location data - for example, on Find postgraduate teacher training (Find)
+- enables spatial mapping, regional planning, and identification of coverage gaps or oversupply areas, informing strategic decision-making
+- helps identify geographic trends and target resources, support, or funding more effectively to regions with specific needs or opportunities
+
+We use the Ordnance Survey (OS) Places API in our postcode address finder, but it does not include geolocation (latitude and longitude) data. Furthermore, geolocation data will not be included by default if a user manually enters an address.
+
+To solve this problem, we use the Google Maps API.
path: app/posts/register-of-training-providers/2025-02-24-geocoding-addresses.md
user: login: tomtrentham
body: I think one of the dev teams looked at using replacing the Google Maps API calls to reduce cost and latency. They were looking at calculating the lat/long from the OS Places data, but not sure how far they got.
created_at: 2025-03-25T12:19:01Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,79 @@
+---
+title: Geocoding addresses
+description: We geocode addresses so users can quickly find and choose training providers based on accurate location data
+date: 2025-02-24
+tags:
+  - addresses
+  - locations
+  - geocoding
+related:
+  items:
+    - text: Managing provider addresses
+      href: /register-of-training-providers/managing-provider-addresses/
+    - text: Adding an address using a postcode address finder
+      href: /register-of-training-providers/adding-an-address-using-a-postcode-address-finder/
+    - text: Using a postcode address finder in the new provider flow
+      href: /register-of-training-providers/using-a-postcode-address-finder-in-the-new-provider-flow/
+screenshots:
+  items:
+    - text: Add provider - check your answers
+      src: add-provider--check-your-answers.png
+    - text: Add address - check your answers
+      src: add-address--check-your-answers.png
+    - text: Add address - check your answers with no geolocation information
+      src: add-address--check-your-answers-no-geolocation.png
+    - text: Provider details
+      src: provider-details.png
+---
+
+Previously, we gave users the ability to [manage provider addresses](/register-of-training-providers/managing-provider-addresses/) and [add an address using a postcode address finder](/register-of-training-providers/adding-an-address-using-a-postcode-address-finder/). This work enables us to collect accurate and reliable address data.
+
+To increase the utility of the address data, we need to geocode addresses as well.
+
+We geocode addresses because it:
+
+- allows users to quickly find and choose training providers based on accurate location data - for example, on Find postgraduate teacher training (Find)
+- enables spatial mapping, regional planning, and identification of coverage gaps or oversupply areas, informing strategic decision-making
+- helps identify geographic trends and target resources, support, or funding more effectively to regions with specific needs or opportunities
+
+We use the Ordnance Survey (OS) Places API in our postcode address finder, but it does not include geolocation (latitude and longitude) data. Furthermore, geolocation data will not be included by default if a user manually enters an address.
+
+To solve this problem, we use the Google Maps API.
path: app/posts/register-of-training-providers/2025-02-24-geocoding-addresses.md
user: login: simonwhatley
body: The OS Places API has `lat` and `lng` attributes for each address, but they're always null, which is odd. Perhaps there is some API configuration I/we need to explore.
created_at: 2025-03-25T12:26:09Z
author_association: CONTRIBUTOR

PR comments:
user: login: netlify[bot]
created_at: 2025-03-20T12:59:58Z
body: ### <span aria-hidden="true">✅</span> Deploy Preview for *bat-design-history* ready!


|  Name | Link |
|:-:|------------------------|
|<span aria-hidden="true">🔨</span> Latest commit | 06ae0e60fe90d8689a6acab085ebba81f1fc1045 |
|<span aria-hidden="true">🔍</span> Latest deploy log | https://app.netlify.com/sites/bat-design-history/deploys/67e16c01cb41e40008854993 |
|<span aria-hidden="true">😎</span> Deploy Preview | [https://deploy-preview-1527--bat-design-history.netlify.app](https://deploy-preview-1527--bat-design-history.netlify.app) |
|<span aria-hidden="true">📱</span> Preview on mobile | <details><summary> Toggle QR Code... </summary><br /><br />![QR Code](https://app.netlify.com/qr-code/eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1cmwiOiJodHRwczovL2RlcGxveS1wcmV2aWV3LTE1MjctLWJhdC1kZXNpZ24taGlzdG9yeS5uZXRsaWZ5LmFwcCJ9.gNAUbI4WqMiaLkzygfwfT-SI6RvsOUm3CjB_eFuzcaA)<br /><br />_Use your smartphone camera to open QR code link._</details> |
---
<!-- [bat-design-history Preview](https://deploy-preview-1527--bat-design-history.netlify.app) -->
_To edit notification comments on pull requests, go to your [Netlify site configuration](https://app.netlify.com/sites/bat-design-history/configuration/notifications#deploy-webhooks)._
author_association: NONE
user: login: tehseenudin
created_at: 2025-03-25T13:51:09Z
body: Looks great - only comment is about the link: https://deploy-preview-1527--bat-design-history.netlify.app/register-of-training-providers/adding-an-address-using-a-postcode-address-finder/ going to a page not found
author_association: NONE