---
title: Map visualizations
description: Learn about map visualization configuration options for AI/BI dashboards
canonical_url: https://docs.databricks.com/aws/en/dashboards/manage/visualizations/maps
---

# Map visualizations

The map visualizations display results on a geographic map. The query result set must include the appropriate geographic data:

* **Choropleth**: Colors geographic localities, such as countries or states, according to the aggregate values of each key column. The query must return geographic locations by name (see [Region lookup tables](https://docs.databricks.com/aws/en/dashboards/manage/visualizations/maps.md#region-lookup-tables) for supported names) or as a [GEOMETRY](https://docs.databricks.com/aws/en/sql/language-manual/data-types/geometry-type.md) or [GEOGRAPHY](https://docs.databricks.com/aws/en/sql/language-manual/data-types/geography-type.md) column. For an example, see [Choropleth map](https://docs.databricks.com/aws/en/dashboards/manage/visualizations/types.md#choropleth).
* **Point map**: Places a marker at a set of coordinates on the map. The query result must return latitude and longitude pairs or a [GEOMETRY](https://docs.databricks.com/aws/en/sql/language-manual/data-types/geometry-type.md) or [GEOGRAPHY](https://docs.databricks.com/aws/en/sql/language-manual/data-types/geography-type.md) column. For an example, see [Point map](https://docs.databricks.com/aws/en/dashboards/manage/visualizations/types.md#point-map).
* **Path map**: Draws lines on the map from a [GEOMETRY](https://docs.databricks.com/aws/en/sql/language-manual/data-types/geometry-type.md) or [GEOGRAPHY](https://docs.databricks.com/aws/en/sql/language-manual/data-types/geography-type.md) line column, with one line per row, or by connecting a sequence of points into a line. Use it for routes, transit lines, rivers, borders, or point-by-point trajectories such as GPS tracks. For an example, see [Path map](https://docs.databricks.com/aws/en/dashboards/manage/visualizations/types.md#path-map).

You can also render shapes from a [GEOMETRY](https://docs.databricks.com/aws/en/sql/language-manual/data-types/geometry-type.md) or [GEOGRAPHY](https://docs.databricks.com/aws/en/sql/language-manual/data-types/geography-type.md) column instead of relying on predefined administrative boundaries or separate latitude and longitude columns. See [Custom geographic data](https://docs.databricks.com/aws/en/dashboards/manage/visualizations/maps.md#custom-geographic-data).

## <a id="map-choropleth-options" />Choropleth options

A choropleth map colors geographic regions — such as countries, states, or counties — based on a numeric value in your data.

### <a id="configure-choropleth-map" />Configure a choropleth map

In the **Data** tab, click **+ Add SQL dataset**, paste the following query, and run it:

**Sample dataset**

```sql
SELECT state, total_sales
FROM VALUES
  ('California', 98750),
  ('Texas', 87200),
  ('New York', 76300),
  ('Florida', 65100),
  ('Illinois', 54800),
  ('Pennsylvania', 48200),
  ('Ohio', 43500),
  ('Georgia', 41200),
  ('North Carolina', 39700),
  ('Michigan', 36100),
  ('New Jersey', 34800),
  ('Virginia', 32500),
  ('Washington', 31200),
  ('Arizona', 29700),
  ('Massachusetts', 28400),
  ('Tennessee', 26900),
  ('Indiana', 25100),
  ('Missouri', 23800),
  ('Maryland', 22600),
  ('Wisconsin', 21300),
  ('Minnesota', 20100),
  ('Colorado', 19400),
  ('Alabama', 18200),
  ('South Carolina', 17600),
  ('Louisiana', 16900),
  ('Kentucky', 15800),
  ('Oregon', 14700),
  ('Oklahoma', 13600),
  ('Connecticut', 12500),
  ('Utah', 11900),
  ('Iowa', 11200),
  ('Nevada', 10800),
  ('Arkansas', 10100),
  ('Mississippi', 9600),
  ('Kansas', 9200),
  ('New Mexico', 8700),
  ('Nebraska', 8300),
  ('West Virginia', 7900),
  ('Idaho', 7400),
  ('Hawaii', 7100),
  ('New Hampshire', 6800),
  ('Maine', 6400),
  ('Montana', 6100),
  ('Rhode Island', 5800),
  ('Delaware', 5400),
  ('South Dakota', 5100),
  ('North Dakota', 4800),
  ('Alaska', 4500),
  ('Vermont', 4200),
  ('Wyoming', 3900)
AS t(state, total_sales);
```

In the visualization editor, configure the following:

1. Set the visualization type to **Choropleth map**.
2. In the **Region** section, under **Country**, click ![Plus icon.](https://docs.databricks.com/aws/en/images/product-icons/PlusIcon.svg). Under **Values**, click **Select a country** and select **United States**.
3. In the **Region** section, under **State/Province**, click ![Plus icon.](https://docs.databricks.com/aws/en/images/product-icons/PlusIcon.svg). Under **Fields**, select `state`.
4. Under **Color**, click ![Plus icon.](https://docs.databricks.com/aws/en/images/product-icons/PlusIcon.svg), select `total_sales`, and set the transform to **SUM**.

![Choropleth map example showing total sales by US state.](https://docs.databricks.com/aws/en/images/dashboards/choropleth-example.png)

### <a id="region" />Region

The **Region** setting tells the map how to interpret the location values in your data. Choose the format that matches your data. Databricks supports administrative boundaries, postal codes, US Census statistical areas (CSA and CBSA), US legislative districts, and EU NUTS regions. For the levels available under each format, along with the names, abbreviations, or codes they accept, see [Region lookup tables](https://docs.databricks.com/aws/en/dashboards/manage/visualizations/maps.md#region-lookup-tables).

If a value in your location column doesn't match the selected format, no data is shown for that region.

Alternatively, select **Custom geometry** to render region boundaries directly from a [GEOMETRY](https://docs.databricks.com/aws/en/sql/language-manual/data-types/geometry-type.md) or [GEOGRAPHY](https://docs.databricks.com/aws/en/sql/language-manual/data-types/geography-type.md) column in your data. See [Custom geographic data](https://docs.databricks.com/aws/en/dashboards/manage/visualizations/maps.md#custom-geographic-data).

### <a id="colors" />Color

Colors populate automatically for each region that has data. Click the color swatch to choose a different color.

![The color setting section in the visualization editor shows the selected color and a plus sign with more options.](https://docs.databricks.com/aws/en/images/dashboards/color-setting.png)

To color regions by a numeric field, click ![Plus icon.](https://docs.databricks.com/aws/en/images/product-icons/PlusIcon.svg) in the **Color** section and select a field. You can apply a transformation such as `SUM` or `MEDIAN`. The map applies a color gradient across the range of values. To customize the colors, gradient, and labels, click the color swatch.

## <a id="region-lookup-tables" />Region lookup tables

Find the section that matches your **Region** setting and download its lookup table to check which names, abbreviations, or codes are supported.

### <a id="lookup-administrative" />Administrative

| Level          | Lookup table                                                                                                |
| -------------- | ----------------------------------------------------------------------------------------------------------- |
| Country        | [country-names.csv](https://assets.docs.databricks.com/_extras/documents/country-names.csv)                 |
| State/Province | [state-province-names.csv](https://assets.docs.databricks.com/_extras/documents/state-province-names.csv)   |
| County/City    | [county-district-names.csv](https://assets.docs.databricks.com/_extras/documents/county-district-names.csv) |
| Town/Township  | [town-names.csv](https://assets.docs.databricks.com/_extras/documents/town-names.csv)                       |
| City/Village   | [city-village-names.csv](https://assets.docs.databricks.com/_extras/documents/city-village-names.csv)       |

> [!NOTE]
>
> For admin-0 (country) boundaries, you can use English names from the `name_en` column directly as the identifier in your query. For other region levels, use the `name_en` column to look up supported values, but use one of the other columns as the identifier in your query.

### <a id="lookup-postal" />Postal

ZIP or postal codes use [zipcode-codes.csv](https://assets.docs.databricks.com/_extras/documents/zipcode-codes.csv).

### <a id="lookup-csa-cbsa" />CSA / CBSA

CSA (Combined Statistical Areas) groups adjacent metropolitan and micropolitan areas with economic ties. CBSA (Core Based Statistical Areas) covers individual metropolitan and micropolitan areas.

| Level                        | Lookup table                                                                                |
| ---------------------------- | ------------------------------------------------------------------------------------------- |
| Combined Statistical Areas   | [us-csa-codes.csv](https://assets.docs.databricks.com/_extras/documents/us-csa-codes.csv)   |
| Core Based Statistical Areas | [us-cbsa-codes.csv](https://assets.docs.databricks.com/_extras/documents/us-cbsa-codes.csv) |

### <a id="lookup-legislative" />Legislative

| Level                   | Lookup table                                                                                                              |
| ----------------------- | ------------------------------------------------------------------------------------------------------------------------- |
| State senate districts  | [senate-names.csv](https://assets.docs.databricks.com/_extras/documents/senate-names.csv)                                 |
| Congressional districts | [congressional-district-codes.csv](https://assets.docs.databricks.com/_extras/documents/congressional-district-codes.csv) |

### <a id="lookup-nuts" />NUTS

NUTS is the EU Nomenclature of Territorial Units for Statistics, with three levels: NUTS 1 (major socioeconomic regions), NUTS 2 (basic regions for regional policy), and NUTS 3 (small regions for specific diagnoses).

| Level  | Lookup table                                                                                    |
| ------ | ----------------------------------------------------------------------------------------------- |
| NUTS 1 | [eu-nuts-1-codes.csv](https://assets.docs.databricks.com/_extras/documents/eu-nuts-1-codes.csv) |
| NUTS 2 | [eu-nuts-2-codes.csv](https://assets.docs.databricks.com/_extras/documents/eu-nuts-2-codes.csv) |
| NUTS 3 | [eu-nuts-3-codes.csv](https://assets.docs.databricks.com/_extras/documents/eu-nuts-3-codes.csv) |

## <a id="point-map-options" />Point map options

A point map places a marker at a set of coordinates for each row in your data.

### <a id="configure-point-map" />Configure a point map

In the **Data** tab, click **+ Add SQL dataset**, paste the following query, and run it:

**Sample dataset**

```sql
SELECT city, latitude, longitude, population
FROM VALUES
  ('New York',     40.7128,  -74.0060, 8336817),
  ('Los Angeles',  34.0522, -118.2437, 3979576),
  ('Chicago',      41.8781,  -87.6298, 2693976),
  ('Houston',      29.7604,  -95.3698, 2320268),
  ('Phoenix',      33.4484, -112.0740, 1608139),
  ('Philadelphia', 39.9526,  -75.1652, 1603797),
  ('San Antonio',  29.4241,  -98.4936, 1434625),
  ('San Diego',    32.7157, -117.1611, 1386932),
  ('Dallas',       32.7767,  -96.7970, 1304379),
  ('San Jose',     37.3382, -121.8863, 1013240)
AS t(city, latitude, longitude, population);
```

In the visualization editor, configure the following:

1. Under **Coordinates**, select **Longitude/Latitude**.
   1. Under **Longitude**, click ![Plus icon.](https://docs.databricks.com/aws/en/images/product-icons/PlusIcon.svg) and select `longitude`.
   2. Under **Latitude**, click ![Plus icon.](https://docs.databricks.com/aws/en/images/product-icons/PlusIcon.svg) and select `latitude`.
2. Under **Size**, click ![Plus icon.](https://docs.databricks.com/aws/en/images/product-icons/PlusIcon.svg) and select `population`.

![Point map example showing US cities sized by population.](https://docs.databricks.com/aws/en/images/dashboards/point-map-example.png)

### <a id="coordinates" />Coordinates

Use the visualization editor to configure the **Coordinates**:

* **Longitude/Latitude**: Choose the column that contains the **Longitude** and **Latitude** components of the map coordinates.
* **Geometry**: Select a [GEOMETRY](https://docs.databricks.com/aws/en/sql/language-manual/data-types/geometry-type.md) or [GEOGRAPHY](https://docs.databricks.com/aws/en/sql/language-manual/data-types/geography-type.md) column to use as the point location instead of separate latitude and longitude columns. See [Custom geographic data](https://docs.databricks.com/aws/en/dashboards/manage/visualizations/maps.md#custom-geographic-data).

### <a id="point-map-color" />Color

For ungrouped data, click the color swatch to change the point colors shown on the map. To apply a grouping strategy, click ![Plus icon.](https://docs.databricks.com/aws/en/images/product-icons/PlusIcon.svg) in the **Color** section of the visualization editor. You can adjust the automatically assigned colors by clicking the color swatch next to each group label in the editor.

### <a id="point-map-size" />Size

Click ![Plus icon.](https://docs.databricks.com/aws/en/images/product-icons/PlusIcon.svg) in the **Size** section to choose a field that reflects quantity. This lets you display dots of varying sizes based on the data value.

## <a id="path-map-options" />Path map options

A path map draws lines on the map. Each line comes from a geometry column, with one line per row, or from a sequence of points that are connected in order.

### <a id="configure-path-map" />Configure a path map

In the **Data** tab, click **+ Add SQL dataset**, paste the following query, and run it:

**Sample dataset**

```sql
SELECT line_name, line_type, ST_GEOMFROMTEXT(wkt, 4326) AS route
FROM VALUES
  ('Line 1 Yonge-University', 'Subway',     'LINESTRING(-79.4103 43.7804, -79.4065 43.7442, -79.3985 43.7057, -79.3860 43.6709, -79.3826 43.6612, -79.3790 43.6524, -79.3807 43.6453, -79.3868 43.6509, -79.3884 43.6549, -79.3934 43.6672, -79.3998 43.6681, -79.4041 43.6674, -79.4160 43.6840, -79.4353 43.6987, -79.4473 43.7247, -79.4617 43.7497, -79.4936 43.7647, -79.5022 43.7740, -79.5273 43.7942)'),
  ('Line 2 Bloor-Danforth',  'Subway',     'LINESTRING(-79.5357 43.6375, -79.5115 43.6482, -79.4843 43.6497, -79.4595 43.6558, -79.4526 43.6570, -79.4263 43.6622, -79.4111 43.6659, -79.3998 43.6681, -79.3860 43.6709, -79.3585 43.6767, -79.3450 43.6801, -79.3126 43.6866, -79.3016 43.6890, -79.2886 43.6952, -79.2795 43.7113, -79.2635 43.7325)'),
  ('Line 4 Sheppard',        'Subway',     'LINESTRING(-79.4106 43.7615, -79.3866 43.7669, -79.3762 43.7691, -79.3661 43.7714, -79.3462 43.7757)'),
  ('Line 5 Eglinton',        'Light rail', 'LINESTRING(-79.4880 43.6835, -79.4770 43.6900, -79.4650 43.6930, -79.4540 43.6952, -79.4420 43.6975, -79.4353 43.6987, -79.4190 43.7015, -79.4090 43.7035, -79.3985 43.7057, -79.3830 43.7085, -79.3660 43.7112, -79.3470 43.7150, -79.3250 43.7180, -79.3050 43.7220, -79.2850 43.7270, -79.2635 43.7325)'),
  ('Line 6 Finch West',      'Light rail', 'LINESTRING(-79.4936 43.7647, -79.5170 43.7638, -79.5330 43.7628, -79.5500 43.7580, -79.5680 43.7500, -79.5850 43.7410, -79.6030 43.7285)')
AS lines(line_name, line_type, wkt);
```

In the visualization editor, configure the following:

1. Set the visualization type to **Path map**.
2. Under **Path**, leave the source type set to **Geometry**. Next to **Geometry**, click ![Plus icon.](https://docs.databricks.com/aws/en/images/product-icons/PlusIcon.svg) and select `route`.
3. Under **Color**, click ![Plus icon.](https://docs.databricks.com/aws/en/images/product-icons/PlusIcon.svg) and select `line_name`.
4. Under **Pattern**, click ![Plus icon.](https://docs.databricks.com/aws/en/images/product-icons/PlusIcon.svg) and select `line_type`.

![Path map example showing Toronto TTC lines colored by line and patterned by mode.](https://docs.databricks.com/aws/en/images/dashboards/path-map-example.png)

### <a id="path-map-source" />Path source

Under **Path**, select the source type that matches how your data defines each line:

* **Geometry**: Select a [GEOMETRY](https://docs.databricks.com/aws/en/sql/language-manual/data-types/geometry-type.md) or [GEOGRAPHY](https://docs.databricks.com/aws/en/sql/language-manual/data-types/geography-type.md) column of `LineString` or `MultiLineString` values. Each row is drawn as one line. Use this source for stored lines such as routes, transit lines, rivers, or borders. See [Custom geographic data](https://docs.databricks.com/aws/en/dashboards/manage/visualizations/maps.md#custom-geographic-data).
* **Long/Lat sequence**: Draw a line by connecting a sequence of points from separate longitude and latitude columns. Set **Longitude** and **Latitude** to the coordinate columns, and set **Order** to the column that sequences the points. See [Order](https://docs.databricks.com/aws/en/dashboards/manage/visualizations/maps.md#path-map-order).
* **Geometry point sequence**: Draw a line by connecting a sequence of points from a single `Point` [GEOMETRY](https://docs.databricks.com/aws/en/sql/language-manual/data-types/geometry-type.md) or [GEOGRAPHY](https://docs.databricks.com/aws/en/sql/language-manual/data-types/geography-type.md) column. Set **Point geometry** to the column, and set **Order** to the column that sequences the points. Only `Point` values are drawn; other geometry types are ignored.

The **Long/Lat sequence** and **Geometry point sequence** sources connect multiple rows into a line. Rows are grouped into one line for each combination of the categorical fields you bind, such as **Color** or **Pattern**, the same way a line chart groups its data. There's no separate path identifier field.

### <a id="path-map-order" />Order

For the **Long/Lat sequence** and **Geometry point sequence** sources, set **Order** to the column that determines the sequence of points within each line, such as a timestamp or a step number. Points are connected in ascending order. The **Order** field doesn't apply to the **Geometry** source.

### <a id="path-map-color" />Color

For ungrouped data, click the color swatch to change the line color shown on the map. To color lines by a field, click ![Plus icon.](https://docs.databricks.com/aws/en/images/product-icons/PlusIcon.svg) in the **Color** section and select a field. You can adjust the automatically assigned colors by clicking the color swatch next to each group label in the editor.

### <a id="path-map-size" />Size

Click ![Plus icon.](https://docs.databricks.com/aws/en/images/product-icons/PlusIcon.svg) in the **Size** section to choose a numeric field that varies line thickness based on the data value. Varying line thickness by field is available only for the **Geometry** path source. Lines from the **Long/Lat sequence** and **Geometry point sequence** sources use a constant width.

### <a id="path-map-line-pattern" />Pattern

Click ![Plus icon.](https://docs.databricks.com/aws/en/images/product-icons/PlusIcon.svg) in the **Pattern** section to choose a categorical field that varies the dash style of each line.

## <a id="custom-geographic-data" />Custom geographic data

You can render maps directly from a [GEOMETRY](https://docs.databricks.com/aws/en/sql/language-manual/data-types/geometry-type.md) or [GEOGRAPHY](https://docs.databricks.com/aws/en/sql/language-manual/data-types/geography-type.md) column in any dataset. Use this to visualize custom shapes such as sales territories, school districts, and store catchment areas, or to plot points without splitting coordinates into separate latitude and longitude columns.

The map draws each row independently, so shapes or points can overlap if your data has multiple rows per region. To combine rows into a single shape per region, use a geometry measure in a metric view. See [Limitations](https://docs.databricks.com/aws/en/dashboards/manage/visualizations/maps.md#limitations) and [Local metric views](https://docs.databricks.com/aws/en/dashboards/manage/data-modeling/local-metric-views.md).

### Define a metric view with a geometry measure

In your metric view YAML, set the geometry or geography column as a measure using one of the supported aggregations: `ST_UNION_AGG`, `ST_ENVELOPE_AGG`, `FIRST`, or `LAST`. Use dimensions for the non-geometry columns you want to group by.

The following local metric view defines `region` as a dimension, `total_sales` as a numeric measure, and uses `ST_UNION_AGG` to combine per-row boundaries into a single shape per region:

```yaml
version: 0.1
source: sales.territories

dimensions:
  - name: region
    expr: region

measures:
  - name: total_sales
    expr: SUM(sales_amount)
  - name: region_shape
    expr: ST_UNION_AGG(boundary)
```

If your geographic data is stored as a serialized string or binary value, cast it to `GEOMETRY` or `GEOGRAPHY` in the measure expression.

### Create a choropleth map

Choropleth maps support `Polygon` and `MultiPolygon` shapes.

1. Add the metric view as a dataset.
2. Set the visualization type to **Choropleth map**.
3. Under **Region**, select **Custom geometry** and select your geometry measure (for example, `region_shape`).
4. Under **Color**, select a numeric measure such as `total_sales`.

### Create a point map

Point maps support `Point` and `MultiPoint` shapes. Use a `Point`-valued geometry measure such as `FIRST(location)` or `ST_UNION_AGG(location)`.

1. Add the metric view as a dataset.
2. Set the visualization type to **Point map**.
3. Under **Coordinates**, select **Geometry** and select your geometry measure.
4. Optional: Under **Size**, select a numeric measure to vary point sizes.

### Create a path map

Path maps support `LineString` and `MultiLineString` shapes. Use a `LineString`-valued geometry measure, or combine per-row segments into a single path per group with `ST_UNION_AGG`.

1. Add the metric view as a dataset.
2. Set the visualization type to **Path map**.
3. Under **Path**, select your geometry measure.
4. Optional: Under **Color**, select a field to color the lines.

### Limitations

Custom geographic data has the following limitations:

* `GROUP BY` isn't supported on `GEOMETRY` or `GEOGRAPHY` columns. To combine multiple rows into a single shape per group, aggregate geometry as a metric view measure using `ST_UNION_AGG`, `ST_ENVELOPE_AGG`, `FIRST`, or `LAST`. Otherwise, each row is rendered independently and shapes may overlap.
* The map renderer uses WGS84 (`SRID 4326`). Databricks reprojects `GEOMETRY` columns in other SRIDs automatically; `GEOGRAPHY` columns must already be `SRID 4326`. Use [ST\_Transform](https://docs.databricks.com/aws/en/sql/language-manual/functions/st_transform.md) in your measure expression to reproject if needed.
* `GEOMETRY` columns with `SRID 0` (unknown coordinate system) aren't rendered.
* `GeometryCollection` values and columns that mix multiple shape types aren't supported.
* Label encodings aren't supported on maps that use a geometry or geography column.
