Skip to main content
{% area_layer
    geography="us_states"
    data="state_sales"
    area_id="state_name"
    value="sum(sales)"
/%}

Examples

US Counties Geography

{% area_layer
    geography="us_counties"
    data="county_sales"
    area_id="county_name"
    value="sum(sales)"
/%}

Custom GeoJSON

{% area_layer
    geojson_url="https://example.com/custom.geojson"
    geojson_id="id"
    data="my_data"
    area_id="region_id"
    value="sum(sales)"
/%}

Attributes

data
String
required
Name of the table to query
filters
Array
default:"[]"
Array of filter IDs to apply
geography
String
Pre-provided geography (use this OR geojson_url + geojson_id)Allowed values:
  • us_states
  • us_counties
geojson_url
String
URL to custom GeoJSON file (required if geography not provided)
geojson_id
String
Property name in GeoJSON features to join on (e.g., “NAME” or “GEOID”)
area_id
String
required
Column name in data that matches geo_id (e.g., “state_id”)
value
String
required
Column or expression for coloring the choropleth (e.g., “sum(sales)”)
color_palette
Array of colors for the choropleth gradient
show_unmatched
Boolean
default:"true"
Whether to show areas that do not have matching data
tooltip
Boolean
default:"true"
Show tooltips on hover
name_property
String
GeoJSON property to use for area name in tooltip (defaults to “NAME”)
value_fmt
String
default:"num"
Format for values in tooltip
zoom_threshold
Zoom range [min, max] where this layer is visible (e.g., [0, 8] shows layer from zoom 0 to 8)
legend
Boolean
default:"true"
Show legend for this layer
legend_label
String
Custom label for the legend (defaults to table name)
where
String
Custom SQL WHERE condition to apply to the query. For date filters, use date_range instead.
having
String
Custom SQL HAVING condition to apply to the query after GROUP BY
limit
Number
Maximum number of rows to return from the query
order
String
Column name(s) with optional direction (e.g. “column_name”, “column_name desc”)
qualify
String
Custom SQL QUALIFY condition to filter windowed results

Allowed Parents