map_layers parameter enables you to define custom maps that can then be used to plot your data in Looker and create map charts.
You then use the field-level
map_layer parameter with a dimension so that you can associate the dimension’s values with a geographic region on your custom map.
See this Discourse article for further information.
Built-in Map Layers
Before creating your own map layers, check whether you can use one of the built-in map layers:
countries- Accepts full country names, alpha-3 three-letter country codes, and alpha-2 two-letter country codes.
uk_postcode_areas- Accepts UK postcode areas (e.g.
RHfor Redhill, or
us_states- Accepts full state names and two-letter state abbreviations.
us_counties_fips- Works on string fields that are a five-character FIPS county code for a U.S. county. This layer works only on the interactive map.
us_zipcode_tabulation_areas- This layer works on string fields that are a five-character U.S. zipcode. Dimensions of
type: zipcodeautomatically use the
Note: Zipcode regions are based on the 2010 zip code tabulation areas, so this map layer does not include many zipcodes like P.O. boxes that do not map directly to regions.
Adding a Map Layer
The general syntax for adding a map_layer is:
namedenotes the name of the map layer you will use to refer to it in LookML.
url, a string, contains a URL that contains your topojson file. We recommend hosting the topojson file in something like a raw Gist for ease of use.
file, a string, specifies the name of a JSON file loaded into the project’s Data section. This can be a file with a filetype extension
Create a custom Neighborhoods map that is hosted at
Create a custom Neighborhoods map called
neighborhoods.json that was loaded into the project’s Data section.
Things to Know
Creating Custom Topojson
For instructions on how to turn a shapefile into a custom topojson on a Mac, see this article.