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.
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.
Which approach to choose?
In some circumstances it may be preferable to upload your spatial data into the visual instead. See this page for an in-depth look at the differences between the methods.
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.
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.

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:
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.
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.
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": [...]}
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.
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 above.
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.

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.
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:
{" & """type""" & ":" & """" & [features.geometry.type] & """" & "," & """coordinates""" & ":" & Text.FromBinary(Json.FromValue([features.geometry.coordinates])) & "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.
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.
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.
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 less than 1 metre 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 above. 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 next page instead.
Last updated
Was this helpful?