Hi,
I’ve pulled through UK postcodes of the data type character varying and in the format ‘LE184NG’
Upon adding to Look ML I notice that there is an existing map_layer_name for UK postcodes.
However, I am not sure if I’m using this correctly as the map visualisation doesn’t work
dimension: delivery_postcode {
type: string
map_layer_name: uk_postcode_areas
sql: ${TABLE}.delivery_postcode ;;
hidden: yes
description: "The delivery postcode for each order"
}
Thanks in advance for any help!
Dawid
February 17, 2022, 8:53am
2
It won’t work because you have a postcode but the map only accepts postcode areas, which is a higher level field:
https://en.wikipedia.org/wiki/List_of_postcode_areas_in_the_United_Kingdom
You can create a derivative field postcode_area by extracting the letters at the beginning of the postcode.
Ah I see thanks Dawid!
Is there any map visualisations that allow you to look more granular? such as on a district level e.g. WC1 for district, WC for area
Dawid
February 17, 2022, 10:04am
4
There’s no map visualisation out of the box that supports that. You’d have to build it yourself. For example there is a district Shapefile available but you would have to convert it to TopoJSON, load it as custom map, and make sure your data is aligned with the map.
https://www.opendoorlogistics.com/wp-content/uploads/Data/UK-postcode-boundaries-Jan-2015-topojson/Districts.json
1 Like
Dawid - do you think you could help with how to do:
You can create a derivative field postcode_area by extracting the letters at the beginning of the postcode.
I’ve tried but not sure how to do it with BigQuery and Looker
Dawid
February 18, 2022, 3:49pm
7
Use the following Regular Expressions:
Area:
^[a-zA-Z][a-zA-Z]?
District:
^[a-zA-Z]+\d\d?[a-zA-Z]?
1 Like