Add a reference layer

Reference layers enable the enhancement of spatial visualizations by overlaying a secondary spatial dataset on the map to provide more context. Power BI hosts this dataset in various formats, including:

  • GeoJSON files with a .json or .geojson extension
  • WKT (Well-Known Text) files with a .wkt extension
  • KML (Keyhole Markup Language) files with a .kml extension
  • SHP (Shapefile) files with a .shp extension
  • CSV (Comma-separated values) files with a .csv extension. The Azure Maps Power BI visual parses the column containing WKT (Well-Known Text) strings from the sheet.

Add a spatial dataset as a reference layer

You have two options to add a spatial dataset as a reference layer. You can either reference a hosted file by providing the URL, or select a file to upload.

To upload a spatial dataset as a reference layer:

  1. Navigate to the Format pane.

  2. Expand the Reference Layer section.

  3. Select File Upload from the Type drop-down list.

  4. Select Browse. The file selection dialog opens, allowing you to choose a file with a .json, .geojson, .wkt, .kml, .shp, or .csv extension.

    Screenshot showing the reference layers section when uploading a file control.

Once the file is added to the reference layer, the file name appears in the Browse field. An 'X' button is added that removes the data from the visual and deletes the associated file from Power BI when selected.

The following map displays 2016 census tracts for Colorado. The areas are colored, based on population, using the reference layer.

A map displaying 2016 census tracts for Colorado, colored by population as a reference layer.

The following are all settings in the Format pane that are available in the Reference layer section.

Setting Description
Reference layer data The data file to upload to the visual as another layer within the map. Selecting Browse shows a list of files with a .json, .geojson, .wkt, .kml, .shp, or .csv file extension that can be opened.

Styling data in a reference layer

Properties can be added to each feature within the GeoJSON file to customize styling. This feature uses the simple data layer feature in the Azure Maps Web SDK. For more information, see this document on supported style properties. Custom icon images aren't supported within the Azure Maps Power BI visual as a security precaution.

The following are examples showing how to set a point features color property to red.

GeoJSON

{
    "type": "Feature",
    "geometry": {
        "type": "Point",
        "coordinates": [-122.13284, 47.63699]
    },
    "properties": {
        "color": "red"
    }
}

WKT

POINT(-122.13284 47.63699) 

KML

<?xml version="1.0" encoding="UTF-8"?> 
<kml xmlns="http://www.opengis.net/kml/2.2"> 
  <Placemark> 
    <Point> 
      <coordinates>-122.13284,47.63699</coordinates> 
    </Point> 
    <Style> 
      <IconStyle> 
        <color>ff0000ff</color> <!-- Red color in KML format (Alpha, Blue, Green, Red) --> 
      </IconStyle> 
    </Style> 
  </Placemark> 
</kml> 

Custom style for reference layer via format pane

The Custom style for reference layer via format pane feature in Azure Maps enables you to personalize the appearance of reference layers. You can define the color, border width, and transparency of points, lines, and polygons directly in the Azure Maps Power BI visual interface, to enhance the visual clarity and impact of your geospatial data.

A map displaying the custom style for reference layer via format pane feature.

Enabling custom styles

To use the custom styling options for reference layers, follow these steps:

  1. Upload Geospatial Files: Start by uploading your supported geospatial files (GeoJSON, KML, WKT, CSV, or Shapefile) to Azure Maps as a reference layer.
  2. Access Format Settings: Navigate to the Reference Layer blade within the Azure Maps Power BI visual settings.
  3. Customize Styles: Use to adjust the appearance of your reference layer by setting the fill color, border color, border width, and transparency for points, lines, and polygons.

Note

If your geospatial files (GeoJSON, KML) include predefined style properties, Power BI will utilize those styles rather than the settings configured in the format pane. Make sure your files are styled according to your requirements before uploading if you intend to use custom properties defined within them.

Style configuration

Setting name Description Setting values
Fill color Fill color of points and polygons. Set colors for different data category or gradient for numeric data.
Border color The color of the points, lines, and polygons outline. Color picker
Border width The width of the border in pixels. Default: 3 px Width 1-20 pixels
Border transparency The transparency of the borders. Default: 0% Transparency 0-100%

The Points section of the format visual pane:

A screenshot displaying the points section of the format visual pane.

The Lines section of the format visual pane:

A screenshot displaying the lines section of the format visual pane.

The Polygons section of the format visual pane:

A screenshot displaying the polygons section of the format visual pane.

Data-bound reference layer

The data-bound reference layer enables the association of data with specific shapes in the reference layer based on common attributes.

To use the data-bound reference layer, drag the column containing unique identifiers (can be location data or not) to the Location field of the Azure Maps visual.

A screenshot showing the location field in Power BI desktop.

Azure Maps matches these identifiers with the corresponding properties in the uploaded spatial file, automatically linking your data to the shapes on the map.

In scenarios with multiple properties, Azure Maps identifies a common property in each shape and compares its value with the selected data column in the Location field. It then uses the property that has the highest number of matches with the selected data column.

A screenshot showing the data-bound reference layer example in Power BI desktop.

If one or more shapes in the reference layer can't be automatically mapped to any data point, you can manage these unmapped objects by following these steps:

  1. Select the Format visual tab in the Visualizations pane.
  2. Select Reference layer.
  3. Select Unmapped Objects.
  4. Select the Show toggle switch to toggle On/Off. This highlights shapes that aren't mapped to any data points.

Optionally, select the Use custom colors toggle switch to toggle On/Off custom fill and border colors for unmapped objects to make them visually distinct on the map.

A screenshot showing the data-bound reference layer example in Power BI desktop with unmapped objects showing in a different color.

Conditional formatting

Conditional formatting can be applied to data to dynamically change the appearance of shapes on a map based on the provided data. For instance, gradient colors can visualize various data values such as population density, sales performance, or other metrics. This is a powerful tool for combining spatial and business data to create interactive and visually compelling reports.

A screenshot showing the conditional formatting controls for points, lines, polygons, and unmanaged objects in the reference layer control in Power BI desktop.

There are several ways to set colors to the shapes. The following table shows the priorities used:

Priority Source Description
1 Preset style in spatial files Color and style as defined in the spatial file
2 Unmapped object colors Custom colors used when the geometry isn’t data-bound
3 Legend colors Colors provided by Legend/Series
4 Conditional formatting colors Colors provided by conditional formatting
5 Custom formatting colors User defined custom styles in the Reference Layer options in the formatting pane
6 Default colors Default colors defined in the Azure Maps visual

Tip

The Azure Maps Power BI Visual can only perform geocoding on valid location data such as geographical coordinates, addresses, or place names. If no valid location data is uploaded, data layers that depend on geocoded locations, such as heat maps or bubble layers, won’t display on the map.

The data-bound reference layer will appear on the map as long as the data column contains unique identifiers that match properties in the spatial file, but to ensure correct results, your data column must include valid geographic information.

Next steps

Add more context to the map: