nrg
Posts: 1
Joined: Wed Sep 02, 2015 11:04 am

Bind UK postcode data to UK map data

I have data bound to UK postcodes that I'm looking to display on the UK map:
http://code.highcharts.com/mapdata/coun ... l.geo.json

From reading the Map Properties in http://www.highcharts.com/docs/maps/map-collection it says postal-code is the postal code for the area, usually two letters wide.

I thought I could match the data with matching the first 2 characters of my UK postcodes with the map's postal-code, but they don't match. For example:
- Portsmouth postcode starts "PO", but the map postal-code is "PS"
- Belfast postcode starts "BT", but the map postal-code is "BF"

Also, some UK postcodes don't have two letters at the start. Is there a technique somebody else has used to bind UK postcodes to the UK map?

Thanks.
User avatar
KacperMadej
Posts: 4632
Joined: Mon Sep 15, 2014 12:43 pm

Re: Bind UK postcode data to UK map data

Postcode areas map in the United Kingdom is different that gb-all map. For sure you will not be able to match UK postcodes data with map as one-to-one assignment. For example Kent is a county in Highmaps map, but in postcode areas map there are more than one postcode areas e.g. CT - Canterbury, ME - Rochester, TN - Tonbridge. TN is partially located in Kent, East Sussex, Bromley, Surrey (source: https://en.wikipedia.org/wiki/TN_postcode_area).

As a solution you could:
- use other map - Postcode areas map. Unfortunately this is not a part of the Map Collection, but you could add it as a custom map as described in General Documentation.
Custom map: http://www.highcharts.com/docs/maps/custom-maps

- parse your data differently, so it will match the map. (I realize that this probably will not be a solution for you, since you want to show data on map and not a map with a data - data is more important.)

As for the wrong postcodes: they seems to be inconsistent, because postcode areas map is different that Highmaps map.
Issue reported here - https://github.com/highslide-software/h ... ssues/4531
Kacper Madej
Highcharts Developer
DrucillaCorker
Posts: 2
Joined: Fri Sep 03, 2021 6:41 pm

Re: Bind UK postcode data to UK map data

Thanks for this useful thread
michal.f
Posts: 1114
Joined: Thu Aug 12, 2021 12:04 pm

Re: Bind UK postcode data to UK map data

Hello

Thank you for your feedback! If you have any questions that you have not found an answer to, feel free to ask.

Best regards!
Michał Filipiec
Highcharts Developer
https://blacklabel.pl/highcharts/

Return to “Highcharts Maps”