Until a few months ago, I have only worked with either Bing maps, filled maps or shape maps (these are the standard visuals in Power BI).
In the last months however, more clients were interested in custom solutions for map visualizations.
In this post I want to explain how to use any kind of map inside Power BI.
In order to understand the map terminology, I want to throw out some things that are important to know.
When I talk about a visual, I am referring to one of these objects inside Power BI. We also have "custom visuals" these are created by (often freelance) developers as a contribution to the community. Currently there are 341 custom visuals in the Appsource marketplace. Some, you have to pay for.
A map is something else though, when I will say map or background I am referring to this
There are all kinds of backgrounds, this is e.g. an OpenStreetMap (which is an open-source map) - OpenStreetMap however also has different backgrounds, like this OpenTopoMap
If we want to use any of those backgrounds in Microsoft Power BI, we need to use a visual to show it in our report.
I have done a lot of research on this and my favorite visual currently is the Icon Map. It is free to use, is being maintained and developed and has a lot of capabilities in terms of visualizations - it is not super easy to use though.
It already offers many built-in background layers (the Mapbox ones require a key)
Now if you want to use your own background layer or map or you have a specific request from your client, you can use the Custom URI (last item in our dropdown) option.
Here you can paste a link to whatever map you want, the Icon Map will render it for you.
What is a Custom URI though? It is basically a link that does something more than opening a website. Think of it as the "mailto:gregor@brunner.bi" kind of code. Here is Microsoft's documentation on it.
So how can we get this custom URI for other maps?
Well first of all you need a tile service (aka web map tile service or WMTS). This makes sure the map will load quickly and efficiently.
https://api.maptiler.com/maps/hybrid/{z}/{x}/{y}@2x.jpg?key=MYKEY#15.0/48.20632/16.36144
the first part of the custom URI is the tile service itself (I am using maptiler.com as an example - they have some free options)
hybrid is the type of map I am using
{z}/{x}/{y}@2x.jpg
This was something I needed to add to my link manually in order to make it work in the Icon Map. I think these are the raster tiles (I don't know exactly how those work to be honest). You can also use other attributes like tileJSON here though, xyz is something like a default and it could be .png instead of .jpg also.
Additionally, you need a key most of the time, this means you might have to register or even pay for certain features.
The last part are the starting coordinates of the map #15.0/48.20632/16.36144 (this was optional)
Resume
If we want to use a custom map in Power BI we need two things:
-A (most likely) custom visual to show it
-A web tile service (where we can get or build our Custom URI)
The custom visual is the container that will put everything together inside Power BI. The tile service will define which map (often you can completely customize and create your own map) is shown and provide the map to the custom visual (you might have to pay for certain features of the tile service).
This was my final product showing the historic city center of Vienna in the Icon Map using a Satellite Hybrid OpenStreetMap.
Comments