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.
Custom background map styles
The Power BI Mapbox visual has some pretty good map backgrounds built in already:
Click on the drop arrow to choose a style - there's even one with live traffic!
However let's explore how you can create your own custom background mapping styles!
Starting to create your own map styles
To do this head to Mapbox Studio (all done in web browser, no need to download anything) and in the main landing page choose New style:
Choose to create a new style.
Choose a template (I've gone for the Basic template), and choose to customise it:
Click on the button shown to customise your template.
I find the Customize button is unresponsive in Edge, but works fine in Chrome (although others at Wise Owl have reported that it works OK in the new version of Edge).
Also check out the Mapbox style gallery where you'll find a load more map styles you can template from - there are quite a few jazzy ones in there!
Editing your map template
In the next screen your new editable map template will load. Editable components are listed on the left:
Explore this area to change colours and switch labels on and off - or click on the land/water/road items to customise things.
You can also customise layers:
The Layers tab gives you options to edit things at a more detailed level; you can filter out layer objects, and change colours and opacity by zoom level.
Adding new layers
To add your own GIS datasets go to Layers and click on the + symbol:
When the New Layer tab loads, select to upload data as shown above.
The types of map file formats MapBox can accept are shown in the upload dialog box (e.g. zipped shapefiles, GeoJSON):
The file formats supported.
Note map files need to be in WGS84 projection
Once you've uploaded a layer head to Unused Sources where you'll find your newly added layer at the bottom of the list:
I've uploaded a layer of the UK's counties.
Select the arrow next to the layer name, then select the layer to add it in. Next head to the Style tab (at the top of this menu):
Styling gives you the power to set your desired layer colours and opacity.
You can find more information on styling across the zoom layers and setting styles to certain layer objects here.
Once you've finished editing your layers hit Publish:
Publishing your new styles!
Your new map styles will then be added to the Styles list in Mapbox Studio. Any uploaded layers you've added will be saved under Tilesets > Custom Tilesets.
By default, MapBox styles are private. Navigate to your Styles page and open the menu for the style you want to share and select Make public if you want to share it. Once you set the style to public, you can reference the style within any application by copying the style URL within the Styles page.
Viewing your new layers
Once you've completed your masterpiece in Mapbox Studio it's time to put it into action in Power BI. Once you're up and running with Mapbox using the previous steps head to the visual format pane then go to Viz Settings:
Click on this drop arrow.
Change the map style option to Custom:
A new box appears into which you can paste your style URL code. You can find this in your Mapbox Studio styles list - click on the 3 dot ellipsis next to your style name to reveal the style URL code.
Voila - your background mapping masterpiece is alive with your Power BI datasets! I hope it was worth the effort!