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.

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.

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

E01000916

Camden 027B

E01000917

Camden 027C

E01000917

Camden 027C

E01000914

Camden 028B

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.

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.

Good to know

Unrecognised codes

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

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.

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.

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.

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

One source of suitable data for this would be to download data in the CSV format from the OS Select and Build 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 Importing GeoJSON or WKT to your data model page.

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

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 Importing GeoJSON or WKT to your data model page. 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.

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.

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.

Screenshot of the Upload Geospatial Data field in the Format Visual window showing the 'Show upload manager' setting toggled off.
Upload Geospatial Data field

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 Loading spatial data into the visual page. 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:

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

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:

Screenshot showing the Show unmatched features setting toggled to On
Show unmatched features 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 Styling features on the map page.

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.

Last updated

Was this helpful?