Are you aiming for that WOW effect when your client opens your report? I've found that people often experience an immediate sense of awe when they see a map visual, especially when it's conditionally formatted to highlight, for example, which country has the highest sales. So, I thought I'd share how you can achieve this and go beyond the built-in shape maps in Power BI. Let’s transform your global data into compelling visual stories!
Why Use Custom Shape Maps?
Custom shape maps allow you to go beyond the default maps in Power BI, giving you the freedom to represent geographic data and tailor visuals to your specific needs. Whether you're visualizing sales data across countries or regional performance metrics, these visuals can provide clearer insights and a more engaging report for your users.
Custom maps can bring your data to life in ways you never thought possible. So, why wait? Let's see how we can do that.
Step-by-Step Guide to Importing Custom Shape Maps
Step 1. Finding the Right Map
First, you need to find the right map, that's crucial! Websites like Natural Earth and D3.js offer high-quality, accurate maps. Ensure you choose maps that are detailed enough for your needs and can be easily converted to the required format for Power BI.
When selecting a map, look for high resolution and accuracy. If they are not in TopoJSON format, the maps should ideally be in a format that can be converted to TopoJSON (like shapefiles or GeoJSON).
For instance, you could go to Natural Earth and download a map of all the countries in the world.
Skip to Step 3 in case your map is already in a TopoJSON format.
Step 2. Converting Maps to TopoJSON
Tools like MapShaper are excellent for converting map files to TopoJSON.
Follow these steps to convert your map to a TopoJSON file:
Upload Your Map: Start by uploading your map file(s) to MapShaper. You could also drop it as a zipped folder.
(Optional & Advanced) Simplify and Edit: Make any necessary simplifications or edits to your map.
Export as TopoJSON: Once you're satisfied, export the map as a TopoJSON file.
Step 3. Make Sure the Shape Map Visual is Enabled
The Shape Map visual is still a preview feature in Power BI. Before importing, ensure you have it enabled in the Options and Settings.
Go to File > Options and Settings > GLOBAL > Preview features and check the Shape map visual box.
Note: You may need to restart Power BI Desktop after you enable the preview feature.
Step 4. Importing TopoJSON Maps into Power BI & Visualizing Your Data
This step brings your map to life, by visually displaying your data!
Insert a Shape Map visual into your report.
Add your data to the map by setting the Build > Location data field.
Navigate to Format pane > Visual > Map settings > Map type. Select <Custom map> from the dropdown and upload your TopoJSON file in the <Add a map type> box.
If your map isn't displaying correctly, double-check the TopoJSON file for errors and ensure your data is properly mapped (Some countries might have a different spelling/name in your data compared to how they are in the TopoJSON file, so make sure you check out the <<View map type key>> option)
Choose the right projection: Choose the right projection to display the Earth as a 2D map. Navigate to Format > Map settings > Projection and select from the three options:
Equirectangular: Converts the globe into a grid of equally sized rectangles.
Mercator: Ideal for sea navigation; polar areas are more distorted.
Ortographic: Offers an out-of-space view
Step 5. Customization
Customize the appearance of your map by adjusting colors, labels, and tooltips. These tweaks make your map more informative and visually appealing.
For example, I added the population for each country as the Color saturation metric. To do this, add the data field or measure into Build > Color saturation. You might also use a Sales Amount metric to adjust the color intensity.
Some additional tips and considerations
Keep it Simple: Avoid cluttering your map with too many details.
Use Contrasting Colors: Ensure there’s enough contrast between different areas for readability (check out my blogpost Colour me impressed)
Auto zoom / Manual zoom: Play around with these options to find the best fit for your case. Auto zoom automatically zooms to the area where you have data, while Manual zoom allows users to manually zoom in and out of the map visual.
Performance: Simplify the TopoJSON file with MapShaper in case you run into performance issues and Power BI cannot deal with that many points (depending on how detailed the map is)
Closing Words
By incorporating custom shape maps into your Power BI reports, you're not just creating visually appealing maps; you're ensuring your data tells a story. Start small, experiment, and gradually implement more advanced features as you become comfortable.
I hope you’re as excited as I am about the endless possibilities with custom shape maps in Power BI!! Give it a try and see how it transforms your reports. If you have any questions or want to share your creations, drop a comment below or reach out to me on social media.
Happy mapping!
P.S. Haven't subscribed yet? Subscribe to MoonStory to stay tuned for some more tips around maps and adding tooltips in the near future. In the meantime, explore some of the previous blogposts.