map_layer

Usage

map_layer: company_regions {
  feature_key: "ISO_A3"
  file: "/map_folder/regions.json"
  format: topojson
  label: "desired label for chart visualization"
  max_zoom_level: 12
  min_zoom_level: 2
  projection: airy
  property_key: "ISO_A3"
  property_label_key: "NAME"
}
Hierarchy
map_layer
Default Value
None

Accepts
An identifier for your map layer, plus subparameters defining your map layer properties.

Definition

The map_layer parameter lets you define a custom map layer that can then be used to plot regional data, such as counties or zip codes, in Looker and create map charts.

When a map layer exists, typically the interactive map visualization is chosen as the default map visualization. The one exception is the US States map, where Looker uses the Static Map Region chart by default because it uses insets for Alaska and Hawaii.

Map layers can accept TopoJSON or GeoJSON files.

For more information about creating a custom map layer file, see the Creating custom map regions Best Practices page.

Looker recommends that you keep custom map layer files smaller than 5 MB to avoid overwhelming the user's browser tab.

Built-in map layers

Looker includes several built-in map layers. Before creating your own map layers, check whether you can use one of the built-in map layers:

The countries and us_states built-in map layers use proper capitalization for the names of countries and states. Data is plotted to the map layer in a case-sensitive fashion, so your data must also use proper capitalization in order to use these built-in map layers. For example, if your dataset uses lower case "new delhi," the data would not correctly plot on the built-in map layers, which use "New Delhi."

  • countries — Accepts full country names, ISO 3166-1 alpha-3 three-letter country codes, or ISO 3166-1 alpha-2 two-letter country codes. Note that you must use only one of these three options in your dataset; you cannot use a mix of these options.

    If your data uses ISO 3166-1 alpha-2, include the map_layer_name parameter in the definition for your country dimension to ensure that Looker recognizes your data as country codes and does not incorrectly interpret the data as state codes. For example:

  dimension: country {
      type: string
      map_layer_name: countries
      sql: ${TABLE}.country ;;
  }