BLOGS BY TOPIC▼
BLOGS BY AUTHOR▼
BLOGS BY YEAR▼
Marie Woltman is a Power BI guru whose maps we often reference on our courses. In this blog she explains why MapBox is her preferred mapping tool, and shows how to use it to create custom styles and layers.
Posted by Marie Woltman on 27 April 2020
You need a minimum screen resolution of about 700 pixels width to see our blogs. This is because they contain diagrams and tables which would not be viewable easily on a mobile phone or small laptop. Please use a larger tablet, notebook or desktop computer, or change your screen resolution settings.
Getting started with MapBox
This page gives a summary of how to get started with MapBox.
Import the custom visual
First, choose to use a custom visual:
Choose to get the MapBox custom visual (unlike ArcGIS, it's not a Power BI standard).
Add the MapBox visual:
Find and add this visual.
You can now add this new visual to your report:
The MapBox visual icon.
Signing up for an account
The moment you add any field to your visual, you'll need to sign up for a Mapbox account (it's free up to maximum of 50,000 map loads per month):
This access token message appears when you drag any field onto your visual.
From the MapBox website, copy the public token:
Use the public token, or create your own.
Go to the formatting tools, and paste this in:
Paste the access token into the relevant property.
You can now drag fields onto your visual to create a map:
A typical map, showing total quantity sold by latitude and longitude.
Some general tips for working with latitude and longitude data in Power BI. Firstly, make sure that your latitude and longitude data formats are set to a decimal number:
If latitude and longitude are set as text, MapBox won''t let you drag and drop to anywhere but location - which isn't helpful.
Secondly, set the data category as Latitude and/or Longitude:
This stops map visuals trying to sum coordinates (which causes errors).
If you've done 1 + 2 but the data points still aren't loading correctly, right-click on the Latitude and Longitude fields in the field well and set them both to Do not summarize.
Choosing map types
You can change the type of map shown here:
Note that you need to add a value under Cluster in the field pane to get cluster views to work.
I've chosen a heat map above, giving this:
A typical MapBox map!
A note on data limits
Mapbox supports up 30,000 rows (the maximum allowed by Power BI) for all visualization types, including choropleths (filled maps), cluster maps, heatmaps and circle maps. If your data has more than 30k rows the Mapbox Visual will sample your data down to 30k rows and visualise the resultant sample.
You could always create a DAX measure to display a warning message when the rows exceed this limit. For example:
Warning message = IF(
COUNT(Purchase[PurchaseId]) > 30000,
"Maximum 30k limit reached - select smaller selection",
You could then add some filters to help people select a smaller selection of data points.
Making cross-filterable choropleths work
If you'd like to incorporate some cross-filterable regional areas in your Mapbox visual so that it acts as a geographic filter selection to other charts in your report, this requires a little more set up. Follow the choropleth setup guidance here. Once set up it opens the door to creating 3D extrusion displays!