With the update of Power BI last week you can now add your own maps in any size or shape to Power BI so you can extend the set of out of the box shapes that come with Power BI. This is possible because the Shape map visual is build upon TopoJSON which is an extension of the the GEOJSON standard. This makes it super easy to add any map you want,. In this blog post we will take a quick look at the existing set of maps and also create one ourselves.
First you need to enable the preview feature in Power BI Desktop:
Next you can drag in the ShapeMap onto the Canvas and assign a column to the location that allows the ShapeMap visual to highlight the shapes to highlight. You can then select the map you want to use, Power BI comes with a set of predefined maps. In my case I pick the Netherlands. Now to to highlight the area of the chart based on your data it has a set of predefined keys defined in any shape, you can view how the shapes can be mapped to your data by clicking โView map keys
Here is the list of keys I can use in my data to map my data with:
That will translate this data:
Into this map using the sales as Saturation:
But since the latest release you can now also add your own map. As the map files are based upon open standard there is a lot of information available on the web, I downloaded some examples from http://mapstarter.com/
For example I now have a map of Africa:
and again it provides me with a list of keys I can connect my data to:
Or a map of the entire world:
And Japan
So how do you get one yourself. The easiest way I found is to download topojson sample files, but there arenโt too many around there. Any easier way is to use shape file and these are in abundance. Once you have one go to http://www.mapshaper.org/ load in the shape file and export as topojson, the load it into Power BI. Here I did one for the map of India:
As you can see you can load almost anything into Power BI now, you could create anything yourself in the shp format and then load it into PowerBI, I downloaded this random shape from the web and loaded it into Power BI:
So you can imagine loading in a factory floor, sports arena, hangar, oil field or airstrip and visualizing it with Power BI.
Here are some other interesting links I found where you can download most the JSON files I used for the sample above:
- Everything you want to know about GEOJSON
- GEOJSON AND KML DATA FOR THE UNITED STATES
- Convert GeoJSON to TopoJSON using http://geojson.io, or http://mapshaper.org
- How to make a map guide
- http://mapstarter.com/
- http://blog.thematicmapping.org/2013/06/converting-shapefiles-to-topojson.html
- http://geoexamples.com/d3/2015/09/25/d3-EUROSTAT-topojson.html
have fun..
David Eldersveld also wrote a great post that helps solve an issue where you have image drawing problems in Power BI.
Cool! Where can I find the map keys? I don’t have that button under the mapname ๐
maybe you need to download the latest Power BI desktop, the July version that got released last week.
True ๐
The field you use for the location should be the same value as the field “name” in the map keys table?
not sure, I believe it can be any of those fields.
Kasper, how do you know the key for the topojson map? I converted a shapefile to topojson and added it to Power BI. Now I am wondering what key I would use to connect the map to my data model. Thanks
It should be supplied by the map supplier
Part of Jammu and Kashmir is not mapped correctly. Please get your facts right. Its a nation issue for us.
which map? This is about custom maps?