Skip to content

Latest commit

 

History

History
130 lines (95 loc) · 5.68 KB

power-bi-visual-add-reference-layer.md

File metadata and controls

130 lines (95 loc) · 5.68 KB
title titleSuffix description author ms.author ms.date ms.topic ms.service services
Add a reference layer to Azure Maps Power BI visual
Microsoft Azure Maps Power BI visual
This article describes how to use the reference layer in Azure Maps Power BI visual.
deniseatmicrosoft
limingchen
12/04/2023
how-to
azure-maps
azure-maps

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

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 or .shp extension.

    :::image type="content" source="./media/power-bi-visual/reference-layer-upload.png" alt-text="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.

To use a hosted spatial dataset as a reference layer:

  1. Navigate to the Format pane.

  2. Expand the Reference Layer section.

  3. Select URL from the Type drop-down list.

  4. Select Enter a URL and enter a valid URL pointing to your hosted file. Hosted files must be a valid spatial dataset with a .json, .geojson, .wkt, .kml or .shp extension. After the link to the hosted file is added to the reference layer, the URL appears in the Enter a URL field. To remove the data from the visual simply delete the URL.

    :::image type="content" source="./media/power-bi-visual/reference-layer-hosted.png" alt-text="Screenshot showing the reference layers section when using the 'Enter a URL' input control.":::

  5. Alternatively, you can create a dynamic URL using Data Analysis Expressions (DAX) based on fields, variables or other programmatic elements. By utilizing DAX, the URL will dynamically change based on filters, selections, or other user interactions and configurations. For more information, see Expression-based titles in Power BI Desktop.

    :::image type="content" source="./media/power-bi-visual/reference-layer-hosted-dax.png" alt-text="Screenshot showing the reference layers section when using DAX for the URL input.":::


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

:::image type="content" source="./media/power-bi-visual/reference-layer-CO-census-tract.png" alt-text="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 or .shp 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> 

Next steps

Add more context to the map:

[!div class="nextstepaction"] Add a tile layer

[!div class="nextstepaction"] Show real-time traffic