arrow-left

All pages
gitbookPowered by GitBook
1 of 14

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

OS Maps for Power BI Visual Getting Started Guide

This getting started guide provides instructions for using the OS Maps for Power BI Visual product. Users with limited technical knowledge will be able to follow this guide.

This getting started guide provides guidance on how to install and use the OS Maps for Power BI Visual. Topics covered in the guide include:

  • Installation

  • Adding an OS basemap

Adding data to the map
Using both map layers together
How to add a polygon reference layer to the map
Using the lasso tool on the map to filter data
Displaying your own geometries within the Power BI Visual

Adding data to the map

The following pages cover adding data to the OS basemap in the OS Maps for Power BI visual

hashtag
Core concepts

The visual allows you to add up to three layers to the map at once, which can be styled and symbolised separately. There is a marker points layer, a features layer, and a reference layer.

The marker points layer can contain point-based data from your Power BI data model, which can be supplied either as coordinates, postcodes, or UPRNs.

The features layer can contain point, line, or polygon data which can be supplied in one of three ways: directly from your data model as WKT or GeoJSON; geocoded from GSS codes in your data model; or matched from a column in your data to features in a spatial dataset that you can upload into the visual.

Finally the reference layer can contain reference data such as administrative boundaries which are geocoded from GSS codes but are not matched to any specific data from your data model.

hashtag
Creating and styling map layers

The pages below include detailed guides on creating and styling a point map within the visual:

Adding an OS basemap

Follow the steps below to add an OS basemap:

1

hashtag
Create a project on the OS Data Hub

Once logged in to the , select Data from the main menu, then select APIs > API Projects from the secondary navigation menu, then click the

Installation

These instructions detail how to install OS Maps for Power BI Visual.

Installing OS Maps for Power BI Visual is straightforward and requires only a few steps. You should have received a link to Dropbox that contains a .pbiviz file with the name of your organisation on it. The .pbiviz file contains the visual that you'll import into Power BI.

hashtag
Installing OS Maps for Power BI Visual

1

Styling features on the map
Creating a point map
Styling points on the map
Creating a map with polygons or other features
Create a new project
button.
Creating a new project in the OS Data Hub.
2

hashtag
Name your project

For this example, the project has been named 'Power BI'.

Naming a project dialog in the OS Data Hub.
3

hashtag
Add an API to the project

Select OS Maps API from the available OS APIs, then click the Add to project button on the right-hand side of the view.

Selecting an API to add to a project in the OS Data Hub.

4

hashtag
Copy the project API Key for use in Power BI

Navigate to the project page and open the project that was recently created for Power BI. The project view will have a project API Key available. Copy this API Key to the clipboard.

An example of a project API Key in the project view of the OS Data Hub.

5

hashtag
Paste the OS Maps API Key into the OS Maps for Power BI Visual

Within the OS Visual setting menu in Power BI, open the Visualizations pane and navigate to Format visual > Map Settings. The first entry of the Map Settings menu is an input text box called 'OS API Key’. Paste in your project API Key from the OS Data Hub into this text box.

Once your project API Key has been added, an OS basemap should render automatically.

circle-exclamation

hashtag
Using Premium data

OS Data Hub websitearrow-up-right
hashtag
Click the three small dots under the Visualizations pane in Power BI

The context menu should provide options to import or remove a visual from Power BI.

Importing a visual using the OS Maps plugin from the Power BI Visualizations pane.
2

hashtag
Click 'Import a visual from a file' from the right-click context menu

The file explorer should open to allow you to navigate to the folder containing the .pbiviz file.

3

hashtag
Select the .pbiviz file

Select the OS Maps for Power BI Visual from the relevant folder, then click OK to import it into the app.

After installing the visual, click the OS icon and add it to a report. When you add a visual to a report, you’ll be presented with a landing page:

OS Visual landing page.

hashtag
Linking the Power BI Visual to the OS Maps API

Rendering a basemap requires an OS Maps API Key, available from the OS Data Hubarrow-up-right. If you already have access to the OS Data Hub, skip to the Adding an OS Basemap page; otherwise, sign up for access to the OS Data Hub using the instructions below.

hashtag
Signing up for the OS Data Hub

For public sector customers (i.e. PSGA Members):

  • Register via the appropriate Public Sector Plan on the OS Data Hubarrow-up-right.

  • You’ll need to be invited by the administrator of your organisation’s OS Data Hub account. (It’s usually someone in your GIS / Geospatial Team.) If you can’t find your OS Data Hub Administrator or want to know their contact details, please contact [email protected]envelope or your OS Account Manager.

For individuals and commercial organisations:

  • Register via an OS Open Data plan on the OS Data Hubarrow-up-right to use the OS Maps API for free.

circle-exclamation

Please note that the maximum zoom levels will be capped for maps using the free OS OpenData plan. The maximum zoom levels will incur a cost as they are classed as Premium data. A Premium data toggle is present within the visual to control this, so you can choose whether to use Premium data or stick to free OS OpenData.

For more information on which zoom levels are OS OpenData and which are Premium data for the OS Maps API, please see the tables on the OS Maps API Layer and Styles pagearrow-up-right.

  • Users requiring maps without restrictions will require a Premium OS data licence. This can be acquired via an OS Partnerarrow-up-right.

circle-exclamation

hashtag
Premium OS data licence for internal business use

Customers shouldn’t sign up for an OS Premium Data Plan directly on the OS Data Hub to use the OS Maps for Power BI Visual for internal business use, as this is not covered under the plan's licence.

Styling features on the map

This page describes how to style features in the Features Layer of the OS Maps for Power BI visual to create maps such as choropleths

Once you have added features to the Features Layer, you can control how they are displayed. You can control the colour of features according to values of a field from your Power BI data, or all together, as well as adjusting the opacity of features and size of any points present.

circle-info

At present you can't vary the size of points in the Features Layer based on a field from your Power BI data. You can only do this for the Marker Points layer.

Feature display is controlled by selecting the "Features Layer" dropdown under the Symbology Settings pane of the Format Visual controls:

A screenshot of the Symbology Settings window

The controls that appear under this pane will vary depending what other data you have added to the visual. If you have not added any data to the Features Layer: Colour field, you will not see the "Min feature fill colour" and "Feature % clip" controls.

hashtag
Varying the colour of features

The colour of features in the Features Layer is controlled in the same way as points in the Marker Points layer, so the instructions for the Marker Points Layer on the apply equally to the Features Layer.

This allows you to create several different types of map:

  • By mapping polygon features and adding a numeric field (or field summary) to the Features Layer: Colour field you will create a choropleth map.

  • By mapping polygon features and adding another type of field, you will create a categorical (or chorochromatic) map. Categorical data in the Features Layer will be coloured according to the same process as in the Marker Points Layer.

circle-info

If you have categorical data in both layers and choose to use default colours for both, then a different colour palette will be used for each layer to ensure that they can be distinguished

  • Point and/or line features can also be symbolised with colours varying according to a numeric or categorical data field.

hashtag
Controlling the appearance of unmatched features

If you have chosen to to populate the Features Layer, you may have features in your uploaded data which do not match any value provided in the data model through the field added to the Features Layer: Linking identifier field well.

If so, you can choose to include these unmatched features on the map. They will be styled using a single symbol, which you can configure using the Unmatched uploaded features dropdown pane of the Symbology Settings:

This allows a couple of advanced mapping features.

Firstly you could combine this with a slicer to create a map that allows interactive highlighting of a particular subset of features, whilst leaving all the other features visible:

Secondly, you could populate the features layer by using one of the other two means (via GSS codes or via geometry from the data model), and then upload a separate dataset which will then be entirely unmatched (because you are not adding data to the Linking Identifier field). This allows you to effectively display an entirely separate dataset for contextual information:

How to add a polygon reference layer to the map

The reference layer feature provides a way to consistently display administrative polygons/boundaries (e.g. LSOAs, wards, etc.) regardless of how point data is filtered on the page.

circle-exclamation

hashtag
Custom geometry

This only works for ONS GSS codes and boundaries (e.g. W00008779). Other geometries are not supported by the reference layer, but you can add these by instead and displaying them as unmatched features.

The reference layer feature can be found under the Visualisations pane > Format Visual > Reference Layer Settings

For a reference layer to be generated, the relevant GSS codes need to be input into the ‘GSS Codes for Reference Layer’ text box.

GSS codes can be copied and pasted directly from a spreadsheet into the text box, and it will automatically work.

Once the codes have been input, the visual should update after a few seconds with the relevant polygons displayed on the map as a reference layer that is not linked to any other data used in the visual.

circle-exclamation

hashtag
Good to know

  • The codes added to the GSS Codes for Reference Layer

You can then style the reference layer features using the appropriate dropdown under the Symbology Settings pane:

circle-info

Note that if you are using GSS codes to populate the map's Feature Layer , the codes that are entered into the Reference Layer dialog will be compared to the codes which are currently displayed in the Feature Layer, and any polygons which are currently being shown in the Feature Layer will not also be displayed in the Reference Layer.

This allows you to create a background in the reference layer which continually updates as slicers / filters are applied to the Feature Layer. However this only works for codes that match exactly; geographies from different overlapping datasets (e.g. MSOA vs LSOA) will not be compared and updated in this way.

circle-info

hashtag
Historic ONS GSS codes

Not all types of GSS code are necessarily supported for the reference layer. The visual makes use of services that are published in the .

These are subject to change from time to time by ONS. The visual may be reconfigured to show new services as we are made aware of them. The table in the FAQs tab of the "Getting Started" dialog tells you which codes are currently supported.

Using both map layers together

As described on the , the OS Maps for Power BI visual supports two main data-driven map layers: a Marker Points layer and a Features Layer. (Additionally, there is a separate reference layer which is not linked to the Power BI data).

However in order to display data in both of these layers simultaneously, you need to carefully structure your data in a certain way. This page explains what is needed, and why.

hashtag
Understanding the limitations of visuals

As with all custom Power BI visuals, the OS Maps for Power BI visual does not have any access to your Power BI data model. It only ever "sees" the fields (or summaries) that are added to the field wells on the Build Visual pane. Every time the visual is refreshed, Power BI calculates and passes the latest representation of these fields into the visual to be displayed.

Loading spatial data into the visual

Loading spatial data into the visual using the Upload Manager provides an alternative means to add your own polygons or other geometries onto the map, and have them symbolised according to values from your Power BI data model.

circle-info

hashtag
Which approach to choose?

Creating a point map

Follow the steps below to add points to the marker points layer of the map. Note that the three ways of adding points (via coordinates, postcodes, or UPRNs) are mutually exclusive; you can only use one at once.

hashtag
Adding points on a map using Longitude / Latitude or Eastings / Northings

If your data has a list of Longitude / Latitude or Eastings / Northings, then you’re able to plot these on a map by simply dragging and dropping the relevant columns in your data into the Points: X and Points: Y fields of the visual.

Displaying your own geometries within the Power BI Visual

The OS Maps for Power BI visual provides two ways for you to display your own geometries in the Features Layer of the visual. This page explains the advantages and disadvantages of each method.

hashtag
Importing data to the data model

If you follow the steps described in you will be mapping geometries that are actually part of your Power BI data model. They will be provided to the visual by Power BI every time the visuals in the report are updated, in line with whatever slicers and filters are currently active.

Depending on how your data model is constructed, the geometries may be coming from some central repository within your organisation and so be kept up to date automatically along with the other data in your report.

textbox will be sent out of the visual to services maintained by the Office for National Statistics, in order to retrieve the geometries.
  • The values you add are checked first to make sure they fit the format of a GSS code (a letter followed by 8 numbers). Any data mistakenly added to this textbox that doesn't match the format won't be sent out of the visual, to prevent inadvertent data loss.

  • This feature makes use of the services published by the ONS Open Geography Portalarrow-up-right and is subject to the availability and currency of those services. Should the services be unavailable, then the visual will not be able to retrieve the geometries.

  • The visual will only support the latest version of geometries for any particular code type. Historic codes are unfortunately NOT supported at this time.

    uploading your own data
    using ONS geographies
    ONS Open Geography Portalarrow-up-right
    Reference layer pane showing GSS codes added to a diague
    A screenshot of the Reference Layer pane
    A screenshot of the symbology settings pane showing colour, opacity, and border thickness settings applied to the Reference Layer
    Symbology settings pane
    hashtag
    Public Sector Organisations / PSGA (Public Sector Geospatial Agreement) Members

    If you want to fully zoom into the map, please make sure that the ‘Use Premium data’ toggle setting located beneath the OS API Key input box (in the Visualizations pane) is switched to On. If you registered on the OS Data Hub using a Public Sector Plan account (i.e. you are a PSGA Member), then there is no additional charge for using Premium data.

    hashtag
    Non-PSGA Members

    For non-PSGA Members using the free OS OpenData plan, please note that the maximum zoom levels will incur a cost as they are classed as Premium data. You should ensure that the ‘Use Premium data’ toggle setting located beneath the OS API Key input box (in the Visualizations pane) is switched to Off.

    For more information on which zoom levels are OS OpenData and which are Premium data for the OS Maps API, please see the tables on the OS Maps API Layer and Styles pagearrow-up-right.

    Map Settings menu in the Visualizations pane of Power BI showing the text box where you can enter an API Key.
    Map Settings menu in the Visualizations pane of Power BI.
    A screenshot of the OS Data Hub projects page showing the 'Create a new project' button in the upper right hand corner
    A screenshot of the create project naming dialog box showing a text box and instructions for naming your OS Data Hub project.
    A screenshot of the OS Maps API available to be added to the project, shown in the OS Data Hub view.
    A screenshot of part of the project view of the OS Data Hub. An example API key is shown.
    Importing a visual using the OS Maps plugin from the Power BI visualizations pane. Image shows the 'Import a visual from a file' option highlighted from the context menu of the OS Maps for Power BI Visualisation plugin.
    OS Visual landing page in Power BI. The main page shows options to add an OS API Key with later steps to create and customise a visualisation.
    Styling Points on the map page
    upload spacial data into the visual
    Screenshot of the Symbology Settings window showing styling settings being applied to the Umatched Uploaded features layer
    A screenshot of the Symbology Settings window
    A map configured to display buildings between 5-7 metres height as a choropleth, with other buildings also visible for context
    A map configured to display buildings between 5-7 metres height as a choropleth, with other buildings also visible for context
    A screenshot of a map created by adding a WKT geometry field representing some buildings from the data model to the Features Layer: WKT or GeoJSON geometries field and styled using a categorical field
    This map has been created by adding a WKT geometry field representing some buildings from the data model to the Features Layer: WKT or GeoJSON geometries field well, and styling it using a categorical field. A separate dataset representing site ownership polygons has been uploaded via the Upload Manager and is being displayed as unmatched data in grey. Both sets of features respond to pop-ups.
    Screenshot of the symbology settings window showing colour, opacity, and size settings being applied to the Features Layer

    Power BI will only pass a single view of data (a table, in effect) at any one time into the visual, based on what has currently been added to the field wells on the Build Visual pane. There is no facility for a visual to receive more than one separate "table" of data from Power BI.

    So, in order to display two separate layers on the map, the data for each layer have to be related in some way so that Power BI is able to combine them into one table, and so that the visual can interpret which row of data should be displayed on which map layer.

    To enable this to work, you need to understand the effect of applying groupings / summaries to your data fields, and you may need to create a new query that combines multiple inputs, in order to drive the visual.

    hashtag
    Illustration

    Consider a query or table representing point locations of events. The table contains a unique easting and northing for each row, and each row also contains a GSS code representing the ward in which that point falls. The first few rows might look like this:

    A table representing point locations of events

    If we add just the easting and northing fields to the visual, the visual will receive one row of data for each point and the map displays as expected.

    If instead of this we add the admin_ward_code field to the visual (into the GSS identifiers to geocode field well), the visual will receive one row of data for each unique value of admin_ward_code - not one for every row of the table - enabling it to create the map that's expected:

    Admin ward code table

    However if we add both the point locations and the ward codes, the visual will receive a table as in the first example, containing duplicate ward codes. This table will be rendered correctly, showing both layers, and the visual will warn you that it has received duplicate features in the Features Layer.

    The difficulty comes when we try to summarise one or more of the features. For example if we try to plot a choropleth showing a count of points within each polygon. You might add a separate "point ID" field to the Features Layer: Colour field well and choose to summarise this by Count.

    However, this will not work. Because Power BI passes the easting, northing, and admin_ward_code into the visual all as part of the same data view / table, if you summarise by count the only thing it can do is count the rows for each unique combination of (easting, northing, admin_ward_code), meaning that the map will end up showing a count of 1 for each polygon.

    hashtag
    Solution

    The easiest way around this is to create a new query for feeding data to the visual. This query needs contain the columns needed for the marker points layer, and also the columns needed for the features layer. It should have two sets of the rows appended together. The first set will have all the columns required for the marker points layer populated, with the columns for the features layer set to null. The second set will have all the columns for the features layer populated, with the columns for the marker points layer set to null.

    This query appends two others, one containing postcodes giving information about point locations, and one containing Output Area codes giving information about polygon geographies

    When using the OS Maps for Power BI Visual, or any other visual, you can gain insight into exactly what data the visual is receiving based on your current settings by selecting "Show As Table" from the "..." menu in the top right of the visual:

    Show as a table menu next to the Visualizations pane

    If your use case involves being able to filter point data but you need boundaries (polygons) to always display on the map, regardless of how the point data is filtered on the page, then see the How to add a polygon reference layer to a map page.

    Data can be combined outside of Power BI or by using built-in Power BI functionality: Append queries - Power Query | Microsoft Learnarrow-up-right

    If using Power BI’s data model view to relate data sets to one another, then the following Power BI help article may help: Model view in Power BI Desktop - Power BI | Microsoft Learnarrow-up-right.

    hashtag
    Alternatives

    If you want to display points on the map in conjunction with polygon features, but the polygons are only for reference and do not need to be linked to any other Power BI data, you can more easily do this by adding a polygon Reference Layer to the map instead (if they are based on ONS geographies), or by using the Upload Manager to upload spatial data for the polygons and then displaying them as Unmatched Features when styled on the map.

    Adding data to the map page
    In some circumstances it may be preferable to have your spatial data included in the data model instead. See this page for an in-depth look at the differences between the methods.

    hashtag
    Using the Upload Manager

    Launch the upload manager by selecting the toggle on the Upload Geospatial Data settings pane. You need to have added some data to at least one field of the visual first, before this will work.

    You can browse to select the file you want to upload. This can either be a GeoJSON file, a TopoJSON file, or a shapefile (either zipped or as individual files).

    circle-info
    • If you are uploading a shapefile, please ensure that all component files (.shp, .shx, .dbf, .prj, .cpg) are included in the zip or uploaded together if uploading individual files.

    • GeoJSON / TopoJSON files should contain latitude/longitude coordinates; shapefiles may be in other coordinate systems but a .prj file must be provided to allow the visual to project the data onto the map.

    • The maximum file size is 50Mb but we recommend you use smaller files than this, as the uploaded data will be stored in the report.

    • The dataset must include at least one unique column, which you'll be able to match to a field in the Power BI data model

    • If there are any problems with the geometries in the file (e.g. self-intersections) then the uploader will attempt to repair them, but if it can't manage it then an error will be displayed.

    Once you've uploaded a file, it will be scanned to identify which columns/attributes contain unique values. These columns will be available to be joined to data from your PowerBI data model. The remaining (non-unique) columns will also be listed, and can be included in the report if you select the "Load all columns to report" checkbox.

    circle-info

    Choosing "Load all columns to report" will allow you to use these columns in pop-ups instead of adding data to the Features Layer: Pop-ups field well. For example the uploaded file may contain all the information you want to display to users, and you want to use the Power BI data simply to filter/slice what is shown.

    However this may reduce performance and increase the size of your report if you have a lot of columns in your data, so we recommend only selecting this option if you need it.

    If the columns seem to be correct, then select "Load Data" to load the data into the Power BI report. Note that if no unique columns are found, this button will not be enabled and you won't be able to use this dataset in the visual.

    circle-info

    hashtag
    Unloading data

    The data are only transferred into Power BI when you press Load Data.

    After loading the data, during the same session of the visual, you can re-open the dialog and remove the data by pressing the rubbish bin icon; the button will then change to "Unload data" and this will remove the data from the report.

    If you reload the visual after choosing Load Data (e.g. by switching to a different report tab and back again), the file information and the rubbish bin icon will not be present when you re-open the dialog. This is because only data that have been transferred into Power BI can be saved between sessions.

    If you want to remove the loaded data from the report later (after the visual has been reloaded) you can just re-add the same dataset, or a different one (this will replace what was loaded before in the report), and then follow the above steps to unload it. The only reason for doing this would be to reduce the report's file size, there is no effect on the functionality of the visual.

    circle-info

    hashtag
    Displaying longitude / latitude data on a map

    • The visual can display up to 30 000 individual points on the map.

    • To see any errors, turn on the 'Show more detailed messaging' toggle under Format visual > Map Settings in the Visualizations pane.

    • If the fields won’t populate with your data, make sure that on Table View the data type for your longitude / latitude data is set to Decimal number and NOT Text.

    • The visual determines whether the coordinates received are latitude/longitude or easting/northing based on the range of the numbers - it does not receive any additional coordinate system information, so it cannot recognise coordinates in other reference systems such as UTM.

    A screenshot of the Longitude type field set to Decimal number in Power BI.

    hashtag
    Adding points on a map using UPRNs or Postcodes

    If your data has a list of postcodes or UPRNs (unique property reference numbers), then you’re able to plot these on a map by simply dragging and dropping the relevant column in your data into the Points: Postcodes or UPRNs field of the visual.

    The 'Points: Postcodes or UPRNs' data field in Power BI.
    circle-info

    hashtag
    Displaying point data on a map

    • Postcodes are plotted according to their corresponding centroid.

    • The visual can display up to 30 000 individual points on the map.

    • Please note, if points appear on the same location, Points: pop-ups will have to be populated with a data attribute that splits out the points (see 'Adding clickable point pop-ups' on the ).

    A screenshot of the Longitude type field set to Decimal number in Power BI.
    circle-exclamation

    hashtag
    Good to know

    • In order to retrieve locations for postcodes or UPRNs, the values you add to this field will be sent out of the visual to our geocoding service

    • The values are checked first to make sure they fit the format of a UK postcode or UPRN. Any data mistakenly added to this field that doesn't match the format won't be sent out of the visual

    • Once retrieved the locations are cached in the report and won't be re-requested by that copy of the visual

    hashtag
    Missing UPRN or postcode points

    If you have incorrect or out-of-date postcodes and UPRNs in your data, they won’t geocode as points on the map. Clicking on the notification panel (the bell icon in the bottom left of the Power BI UI) will let you know which UPRNs or postcodes failed to geocode and are incorrect.

    A screenshot of the notification panel in Power BI showing incorrect postcodes that failed to geocode.

    More detailed information, such as how many postcodes / UPRNs the visual attempted to geocode and how many succeeded, can be found by clicking on the notification panel after turning on the 'Show more detailed messaging' toggle found under Format visual > Map Settings in the Visualizations pane.

    Map Settings menu in the Visualizations pane in Power BI showing the 'Show more detailed messaging' toggle turned on.
    X and Y point data fields in Power BI.
    The disadvantages of this approach are:
    • There are stringent limitations imposed by Power BI on how complex the individual geometries can be.

    • It can be quite complex to import your data to the data model if they are not already available there, and if you are not familiar with using GIS software to prepare the data.

    circle-exclamation

    hashtag
    Complex geometry limitations

    This approach relies on having your geometry stored as a text field within your data model. There's a Power BI limitation where each field has a maximum size of 32kb. Any text longer than this will be truncated, and so the visual won't be able to display that feature it as it's incomplete.

    Power BI does this truncation without any notification, but the visual does some checks, and if it believes it has been given truncated data by Power BI, a warning will be displayed in the notifications box.

    Complex geometries with lots of vertices are quite likely to exceed this limit and so cannot be used with this feature - it works best with relatively simple features such as buildings etc. For more complex geometries, you may be able to simplify them, following the guidelines on . If this doesn't work, you will have to upload them directly into the visual instead.

    hashtag
    Loading spatial data into the visual

    The alternative approach is to load your spatial data from a file directly into the visual.

    If you take this approach, you will be mapping geometries that are stored within the visual itself. The geometries do not become part of the data model, and Power BI itself does not "know" about them.

    The visual remembers all the geometries, regardless of what data Power BI are currently sending to it based on current slicers and filters. It determines which geometries to show on the map based on looking up values of a field you specify in the data that Power BI provides to it.

    This approach does not have the same limitations on geometry size that are described above, and it is likely to be more straightforward in many situations.

    Because the visual has access to all the geometries, it also means you can continue to show them as "unmatched features" even if filters or slicers mean that their associated features are not currently being sent to the visual by Power BI.

    However uploading data into the visual means that it is stored directly within the Power BI report file, rather than in the data model. If you have multiple copies of the OS Maps for Power BI visual in your report, each will store its own copy of any data you add to it.

    Therefore, especially if you have multiple copies of the OS Maps for Power BI visual in your report, this can lead to larger report file sizes and be less efficient. Also, the spatial data will not be refreshed with the data model, they are simply saved from when you uploaded them.

    Importing GeoJSON or WKT to your data model

    Using the lasso tool on the map to filter data

    The visual has been designed so that clicking on a point or polygon on the map displays a pop-up with additional useful information about that location instead of filtering data in other visuals on the page.

    circle-info

    At present we have chosen this approach rather than using the in-built Power BI tooltips, in order to support situations such as overlapping features (with paginated pop-ups)

    Instead of clicking to select features, the lasso tool allows you to filter the data on other visuals based on a selection taken from the map.

    1

    hashtag
    Select the lasso tool by clicking on the lasso icon in the top right of the map.

    Your cursor should change shape once the lasso button has been clicked.

    circle-info

    The lasso tool is only available when the visual is receiving unfiltered data from Power BI. If another visual is already filtering or slicing the data, the lasso tool will be unavailable.

    2

    hashtag
    Draw a ‘lasso’ by holding down the left mouse button and dragging the cursor around all the points / polygons that you want to filter the other visualisations on the page by.

    A cyan coloured shape will be created during the process.

    3

    hashtag
    Once you’re happy with your selection, release the left mouse button.

    Any points / polygons completely within the boundaries of the lasso shape created will now be highlighted cyan and the other visualisations on the page will be update reflecting the selection made.

    circle-info

    hashtag
    Maximum number of data points

    The lasso tool can only select up to 500 different data points on the map at a time to ensure adequate performance.

    this page
    A screenshot of a table representing point locations of events with their corresponding admin ward code
    A screenshot of the admin ward code table for map points
    A screenshot of a table showing Postcode, Property Type, Output Areas, and Obseved value fields
    A screenshot of the Show as a table menu item in the context menu of the Visualizations window of the Power BI plugin
    Creating a point map using categorical data page
    A screenshot of points: X and points: Y data fields in Power BI with no data added.
    A screenshot of the Longitude type field set to Decimal number in Power BI.
    A screenshot of the 'Points: Postcodes or UPRNs' data field in Power BI, allowing users to plot Postcodes or UPRNs on their map.
    A screenshot of the Longitude type field set to Decimal number in Power BI.
    A screenshot of the notification panel in Power BI showing a series of incorrect postcodes that failed to geocode
    Map Settings menu in the Visualizations pane showing the 'Show more detailed messaging' toggle turned on.
    An example of data selected using the lasso tool
    A screenshot showing data selected using the lasso tool

    Styling points on the map

    Once you have added points, you can control how they are displayed. For the marker points layer, you can control both the size and the colour of points according to values of a field from your Power BI data, or by changing all points together.

    Point display is controlled by selecting the "Markers (points-only) Layer" dropdown under the Symbology Settings pane of the Format Visual controls:

    A screenshot of the Symbology Settings pane

    The controls that appear under this pane will vary depending what other data you have added to the visual - you will not necessarily see all the controls visible in the image above.

    hashtag
    Changing the size or colour of all points together

    If you have not added any data to the point colour or point size fields on the Build Visual pane, then the symbology settings pane will appear like this. You can change the colour, opacity, size, and border thickness of all point markers. Note that the colours appearing in the colour picker are taken from the current Power BI report theme.

    hashtag
    Varying the size of points

    It’s quite common that you might want to vary the size (radius) of the points on a map to represent an increase in occurrence or density (for example, larger points represent a greater number of crimes at a location).

    To do this, having plotted points on a map, drag a data column containing numeric data into the Points: Size field of the visual. Then, if there are multiple points at each location, you can click on the downward arrow of that field and select an appropriate summary. Now the size of your points will be based off the value of the single data point at that location, or a summary of all the values at that location. (Note that if there are multiple points at one location and no summary is applied, a warning will be shown in the notifications pane).

    At this point the symbology pane will update to show controls allowing you to control the range of sizes of the points on the map, instead of a single size control. Additionally the map legend will update to show the size of points as they appear on the map.

    The "Points size % clip" slider allows you to reduce the effect of outliers on the appearance of points. The values above and below these percentiles will be excluded from the scaling calculation.

    circle-info

    hashtag
    Varying point size in the OS Maps for Power BI Visual

    • You can combine the colouring of points based on categorical data and the size of points by another data attribute to represent two different variables in a single point within your data.

    See an example below showing a combination of categorical data (crime type) and point size variation (count of crime).

    hashtag
    Varying the colour of points

    You can also vary the colour of points on the map according to a variable from your Power BI data. Add the appropriate field to the Points: Colour field of the visual to do this. This can be a numeric field or a non-numeric field.

    If you add a numeric field, the points will be coloured by ramping / interpolating colours between two endpoints that you can choose on the Symbology Settings pane. If you add any other field, this will be treated as "categorical" data and each unique value will be given a distinct colour. This would be appropriate for data that's divided into groups, such as age, gender, occupation, etc.

    circle-info

    hashtag
    Using numeric data

    • When you add a numerical field the symbology settings pane will update to include these controls:

    circle-info

    hashtag
    Using categorical data

    • When you add a non-numeric field to the Points: Colour field well, the symbology settings pane will update to include these controls:

    hashtag
    Adding clickable point pop-ups

    Additional information about a point can be displayed as a pop-up when a point on the map is clicked.

    To add a pop-up to a point on the map, drag and drop data into the Points: Pop-ups field in the Visualization pane. Information included in the pop-up field will be shown when a user clicks on a point.

    You can add more than one field to the Points: Pop-ups field well and they will be shown in a table in the pop-ups. You can re-order the fields in the field well to control the order in which they display in the pop-ups. You can configure the formatting of fields using the standard Power BI field formatting tools (under Format visual / General / Data format) e.g. to display numbers as currency.

    circle-info

    hashtag
    Point pop-ups

    • Multiple data columns can be shown under pop-ups.

    hashtag
    Handling overlapping points on a map using pop-ups

    It’s quite common that points on a map might have identical locations, making the data more difficult to understand. For example, when considering crime data, a shoplifting crime and a violent crime may have been recorded to the same x, y coordinates or postcodes; however, only one point can be shown at each location.

    If this is the case with your data and you then add a field to symbolise by colour or size, this may be hard to understand on the map. In this situation, a warning will be generated in the notifications pane, telling you that the data contains duplicate point locations, so that you can decide how to handle this.

    For numerical data, it may be appropriate to apply a summary to the colour / size field to show, for example, the total number of people affected at a given location. For other forms of data, especially categorical, this will be less appropriate. In this case, you can add a suitable column that distinguishes points to the Points: Pop-ups field. The pop-up at these locations will then be paginated, allowing viewers to see all the values occurring at that location.

    Below is an example of a pop-up where data representing crime type is being used to enable pagination of overlapping points; the pop-up shows there are five points representing different crime types in the same location:

    Creating a map with polygons or other features

    Follow one of the steps below to add polygons or other features to the features layer of the map. Note that the three ways of adding features (via GSS codes, geometry from your data, or by uploading a data file) are mutually exclusive; only one method can be used at a time.

    hashtag
    Using ONS geographies

    Creating a choropleth (or fill) map using Office for National Statistics (ONS) geographies — such as Lower layer Super Output Areas (LSOAs) and wards — in the OS Maps for Power BI Visual is straightforward and does not require a separate geometry file.

    To make the following steps work, your data will need a column that includes ONS Government Statistical Service (GSS) codes.

    circle-info

    hashtag
    GSS codes

    GSS (Government Statistical Service) codes are nine-character alphanumeric codes which correspond to geographies that ONS supports, for example, an LSOA code looks like this: E01000917.

    Examples of LSOA codes are shown in the table below:

    LSOA Code
    LSOA Name

    To display these geographies as polygons on a map, simply drag and drop the column of data that has these codes into the Features Layer: GSS identifiers geocoding field of the visual.

    circle-exclamation

    hashtag
    Good to know

    • The data added to the Features Layer: GSS identifiers

    circle-info

    hashtag
    Unrecognised codes

    Not all types of GSS code are necessarily supported for geocoding. The visual makes use of services that are published in the .

    These are subject to change from time to time by ONS. The visual may be reconfigured to show new services as we are made aware of them. The table in the FAQs tab of the "Getting Started" dialog tells you which codes are currently supported.

    hashtag
    Using geometries from the Power BI data model

    If you have a column in your data that contains geometries in either WKT or GeoJSON format, you can add these to the Features Layer of the map by dragging that column to the "Features Layer: WKT or GeoJSON Geometries" field of the Build Visual pane.

    circle-info

    One source of suitable data for this would be to download data in the CSV format from the service. The CSV files produced by this service contain geometry columns in the necessary WKT format and can be imported into your Power BI data model.

    More detailed information on how to import GeoJSON or other data into your Power BI data model can be found on the .

    Note that you are not limited to using polygon geometries; points and lines also work.

    circle-info

    hashtag
    Limitations

    If your geometry is particularly complex, it may not fully display using this method due to an inherent limitation within Power BI. Possible workarounds are discussed on the. Alternatively you can upload a spatial dataset directly into the visual rather than adding it to the Power BI data model - see 'Uploading spatial data into the visual' below.

    hashtag
    Uploading spatial data into the visual

    You can also upload your own spatial data directly into the visual itself, and then link it to your Power BI data via a common attribute to allow data-driven styling of the features. You can upload data from a GeoJSON file, a TopoJSON file, or a shapefile. Note that you are not limited to using polygon geometries; points and lines also work.

    To use this feature, first ensure that you have added some data to the visual on the Build Visual pane. You can add the Power BI data you want to join to your uploaded data, and / or any other columns of data.

    circle-info

    The visual cannot be properly rendered or updated by Power BI unless some data have been added to it. So you need to add Power BI data on the Build Visual pane before uploading spatial data.

    Next go to Format Visual > Upload Geospatial Data and toggle on Show upload manager.

    A dialog will appear in the visual allowing you to upload data from a file on your computer. Follow the steps in this Upload Manager dialog to upload you data to the visual. More information on this stage of the process can be found on the . Return to this page when you have followed the steps to upload the data.

    Once you have used the Upload Manager to load data into your visual, the settings pane beneath the Upload Manager toggle will update to show the filename of the data you loaded, and the dropdown will show the names of the unique columns in the dataset:

    You can now select which column you wish to join to the Power BI data model.

    Then, if you have not already done so, add the corresponding column from your Power BI data to the Features Layer: Linking identifier to match in uploaded geometries field well. You should now see the features from your dataset that match a value in the Power BI data showing on the map.

    You can also display features from the uploaded data which do not match the Power BI data, by simply selecting the appropriate toggle:

    These unmatched features are symbolised separately with a single symbol (because they do not have Power BI data to drive their styling). More information is on the .

    circle-info

    If no features match between the Power BI data and the uploaded data, selecting this toggle will mean that the visual is simply providing a view of your whole uploaded dataset. However you still need to have some data added to at least one field well of the visual for Power BI to render the visual properly.

    Importing GeoJSON or WKT to your data model

    This page describes how to add data from a GeoJSON file, or a CSV containing WKT or GeoJSON geometries, directly into your Power BI data model.

    There are two valid data formats that the visual accepts to display custom geometry in the Features Layer via the Features Layer: WKT or GeoJSON Geometries field well. These geometries need to be properly formatted within your data in order to be displayed on the map.

    The instructions on this page describe how to get WKT or GeoJSON data into the Power BI data model in a form that you can add to the map via the Features Layer: WKT or GeoJSON Geometries field well.

    circle-exclamation

    hashtag
    Warning

    There is a 32kb limitation imposed by Power BI on field lengths, which means that complex geometries can't be displayed with the method described on this page.

    circle-info

    hashtag
    Which approach to choose?

    In some circumstances it may be preferable to upload your spatial data into the visual instead. See for an in-depth look at the differences between the methods.

    hashtag
    How to use WKT data to add custom geometry to a map

    Because WKT is simply a text-based geometry format, it's quite common that it might be present as a column in an existing table such as a database table or query, or a CSV file.

    circle-info

    For example you might have downloaded some data from the service, selecting the CSV format.

    In this case, you can simply add that table to your Power BI data model by selecting Get Data / Text/CSV and following the steps to load the CSV file into your data model, and establish appropriate relationships between it and your other queries. You can then add the WKT column straight into the visual.

    circle-info

    hashtag
    WKT geometry data

    Your data needs to include a column that consists of WKT geometry to display it on the map.

    Values in this column might look something like this:

    hashtag
    How to use GeoJSON data to add custom geometry to a map

    GeoJSON is another text-based format, which can be used to represent geometries (as with WKT, above), or entire features or feature collections (a feature comprises both geometry and attributes).

    It's possible to have GeoJSON geometries or features present as a column in an existing table such as a CSV file. In this case, the process for adding the features to the visual is identical to the one for adding WKT as described above.

    circle-info

    hashtag
    GeoJSON as an attribute in a table

    If you have GeoJSON present as an column in a table, the values in that column might look something like this (this is a GeoJSON geometry):

    {"type": "Polygon", "coordinates": [...]}

    hashtag
    Load a GeoJSON file to a Power BI query

    It's more likely that you may have a standalone GeoJSON file. The following steps describe how you can import a GeoJSON file into Power BI, to turn it into a table that you can add into the visual by following the steps .

    These instructions may be easier to follow by navigating to the ‘Add Some Data Tab’ on the landing page then looking for the ‘GeoJSON (from Power BI data model)’ section. The landing page can be accessed via the ‘Question Mark’ button in the bottom left. You can copy and paste the necessary code from there.

    1

    hashtag
    Go to Get data > JSON > Connect and navigate to your GeoJSON file.

    This should open your data in query view and your features will be automatically expanded, giving you columns like 'features.geometry.type'.

    Performing this action may have expanded your GeoJSON more than necessary, so in the Query Settings panel (probably on the right side of the window), click the cross next to 'Expanded features.geometry.coordinates' in Applied Steps to remove the step that expands your coordinates.

    hashtag
    Converting your data

    You might have geometry in shapefile, geopackage, or another format. You can use GIS software such as QGIS to turn those formats into WKT that the visual will accept.

    Start by loading your geometry into QGIS by dragging it into the QGIS window. Then, under Layers, right-click and select Export, then Save Feature as. Save your file as a CSV, then under ‘Geometry’ you want to select AS_ WKT.

    Exporting your file as a CSV will create a file with every polygon listed as a separate entry alongside any additional metadata associated with those polygons from the original file. The WKT column in that CSV is what you’d drag into the Features Layer: GeoJSON or WKT Geometry in the OS Visual to display the geometry.

    hashtag
    Simplifying your data

    If you are having problems with the 32kb limitation described previously, you can also use QGIS to simplify your geometry and remove unnecessary precision, which may help to get around the issue.

    circle-info

    As an alternative to QGIS, you may be able to use an online service such as Map Shaper – to simplify your data.

    Start by loading the data into QGIS as described above.

    Next you can experiment with simplifying the data to remove unnecessary coordinates. The Simplify tool can be found under Vector / Geometry Tools / Simplify in the current version of QGIS. An appropriate "tolerance" depends on the size of your features and how far you need to be able to zoom in the map. If you are not using Premium zoom levels, then a tolerance of 1 or 2 metres would certainly not result in any visible degradation of the features. At the higher Premium zoom levels, a smaller value may be needed. This may or may not make a difference to the size of your geometries, depending on how much detail was in them to start with.

    Next you can also reduce the precision of the coordinates so that they are stored in the WKT using fewer digits, thereby taking less space. This is a two step process:

    • Firstly export the data to GeoJSON, using an appropriate value for coordinate precision. If the data are in BNG coordinates (metres) there is no benefit in storing numbers to multiple decimal places, so a value of 1 is fine. For data in latitude/longitude coordinates (degrees), a value of 6 would represent so is generally appropriate.

    • Next add the exported GeoJSON back into your QGIS map, and then re-export this to CSV with WKT geometries, following the process described . You should now find that the geometry coordinates in the file have been rounded, and occupy less space.

    If, after following all these steps, you are still unable to add the data to the visual due to the 32KB limitation, we recommend that you load the data using the approach on the instead.

    field will be sent out of the visual to services maintained by the Office for National Statistics, in order to retrieve the geometries.
  • The values you add are checked first to make sure they fit the format of a GSS code (a letter followed by 8 numbers). Any data mistakenly added to this field that doesn't match the format won't be sent out of the visual.

  • This feature makes use of the services published by the ONS Open Geography Portalarrow-up-right and is subject to the availability and currency of those services. However once a geometry has been received and the report is saved, the information will be cached in the report for viewers.

  • The caching improves reliability and means that once retrieved, the polygons won't be re-requested by that copy of the visual.

  • The visual will only support the latest version of geometries for any particular code type. Historic codes are unfortunately NOT supported at this time.

    Any codes for which a polygon could not be retrieved won’t display a polygon on the map. The notification panel will display what codes did not work.

    E01000916

    Camden 027B

    E01000917

    Camden 027C

    E01000917

    Camden 027C

    E01000914

    ONS Open Geography Portalarrow-up-right
    OS Select and Build arrow-up-right
    Importing GeoJSON or WKT to your data model page
    Importing GeoJSON or WKT to your data model page
    Loading spatial data into the visual page
    Styling features on the map page
    An example of polygons displayed on a background map within the OS Maps for Power BI Visual. Image shows an area of London with polygons overlayed showing wards around the area of the City of London
    An example of polygons displayed on a background map within the OS Maps for Power BI Visual.
    Screenshot of the 'Features Layer:WKT or GeoJSON Geometries' field in the Power BI plugin showing the field dialog active.
    'Features Layer: WKT or GeoJSON Geometries' field
    Screenshot of the Upload Geospatial Data field in the Format Visual window showing the 'Show upload manager' setting toggled off.
    Upload Geospatial Data field
    screenshot showing the appearance of the Upload Geospatial Data settings pane after uploading a file named "MC_NGD_BFBP_LL" with three unique columns named fid, osid, and toid
    Appearance of the Upload Geospatial Data settings pane after uploading a file named "MC_NGD_BFBP_LL" with three unique columns named fid, osid, and toid
    Screenshot showing the Show unmatched features setting toggled to On
    Show unmatched features toggle

    Camden 028B

    POLYGON((443676.485 240103.531,443679.085 240104.831,443676.681 240109.636,443674.081 240108.336,443676.485 240103.531))

    The coordinate values must be either latitude / longitude or British National Grid coordinates.

    A column like this can be added straight to the Features Layer: WKT or GeoJSON Geometries field.

    Or something like this (this is a GeoJSON feature, with attributes): {"type": "Feature", "properties": {...}, "geometry": ...}

    A column containing values like the above can be added straight to the Features Layer: WKT or GeoJSON Geometries field.

    If the Feature has properties, these will be added to map pop-ups by default, but will be replaced if a column is dragged into the Features Layer: Pop-ups field.

    2

    hashtag
    Make a custom column to drag into the visual's GeoJSON field

    In the toolbar at the top go to ‘Add Column’ Custom Column. In the dialog box, add a name such as 'geom' and enter the following formula:

    Click OK, go back to the Home tab and Close & Apply, then drag your new 'geom' column into the Features Layer: GeoJSON or WKT Geometries field in Build visual.

    this page
    OS Select and Buildarrow-up-right
    above
    https://mapshaper.orgarrow-up-right
    less than 1 metrearrow-up-right
    above
    next page
    Getting started with OS Maps for Power BI Add some data tab
    A screenshot of the Save Vector Layer as dialog box in QGIS
    Save Vector Layer as dialog box in QGIS
    {" & """type""" & ":" & """" & [features.geometry.type] & """" & "," & """coordinates""" & ":" & Text.FromBinary(Json.FromValue([features.geometry.coordinates])) & "
  • Point size only accepts a numeric data type.

  • The map legend will update to show a visualisation of the point sizes, enabling your viewers to understand what size corresponds to what value.

    • The "Points colour % clip" control works in exactly the same way as the one for sizes, allowing you to exclude outliers from the colour ramping so that you can see the range of variation in the data that is of most interest.

    • The map legend will update to show a visualisation of the colour ramp enabling your viewers to understand what colour corresponds to what value.

    • Up to 12 different categories within your data will be allocated unique colours. (It is likely to be hard for your viewers to distinguish more than this number of unique colours on the map). Any additional unique values will be displayed in a single grey colour.

    • The "Use recommended colours for categorical data" toggle means that a fixed palette of colours will be used to symbolise the data, and the colour dropdowns will be ignored. This palette has been chosen to maximise contrast between each value, whilst considering the needs of those with colour vision deficiencies. If categorical data are also present in the Features Layer then a different palette will be used for each layer to ensure the two can be distinguished.

    • If the toggle is disabled, then the colours will be interpolated between the "First point colour" and "Last point colour" values.

    • The map legend will update to show a visualisation of the colour / value pairs, enabling your viewers to understand what colour corresponds to what value.

    • If you need to override the colour for one or more values, you can achieve this by specifying the relevant colour hex code (for example, #cdf1f0) in the colour field in your Power BI data. If the visual sees a value like this, it will recognise it as a colour and use it directly, overriding the symbology settings described above.

    • Adding hex codes into your data to manipulate the point colours won’t update the category colours within the legend.

    By enabling point pop-ups based on different data attributes, points that appear in the same location can be distinguished on the map (see screenshot below, where points at the same location have different crime type data).

    Screenshot of the apply settings to Symbology Layer pane showing styling settings
    Screenshot of the apply settings to Symbology Layer pane
    Points (size) field in the Build Visual pane showing a field called Price Paid with an Average summary applied
    Screenshot of points styling settings in the symbology pane
    A Power BI visualisation showing categorical data used with point size variation. Image shows crime type data displayed on the map with point size variation used to show variance in the count of crime data
    A Power BI visualisation showing categorical data used with point size variation.
    A screenshot of point data filtered by crime type within the visualisation in Power BI.
    Point data filtered by crime type data.
    An example of a pop-up showing data for multiple points on a map in the visual in Power BI.
    An example of a pop-up showing data for multiple points on a map in the visual in Power BI.
    Symbology settings pane showing styling settings for a Markers (points-only) Layer
    A screenshot of symbology settings visual controls active within the symbology settings pane
    A screenshot of symbology settings visual controls active within the symbology settings pane
    Examples of colour-coded data added to the visual in Power BI.