TopoJSON Map Files for Power BI Shape Map



About a month ago, I started a collection of TopoJSON map files in response to a request on the Power BI Community forum. TopoJSON is D3’s preferred format, which is why Power BI users have suddenly found themselves learning more about it after the Shape Map was released. It is an optimized and lightweight cousin of the more prevalent GeoJSON, but there are not many files available in TopoJSON format. As a result, a subset of Power BI users have been converting files from Shapefile, GeoJSON, and other formats into TopoJSON on their own.

world-countries

I have posted a modest collection of files in a GitHub repository at:
https://github.com/deldersveld/topojson




Please make sure that you save the “Raw” version of the .json file. Rather than right-clicking and performing a Save Link As on the links directly in the Read Me, click the link to view a preview of the map, and then right-click on the Raw button at the top and select Save Link As.

json-maps

Here’s a sample of what is available:

  • World map with continents and world map with countries
  • Individual continent maps with countries
  • US counties
  • US congressional districts (2015)
  • US cartogram based on each state’s population
  • Individual US state-level counties
  • Denmark – counties and municipalities
  • Finland – provinces and regions
  • France – departments
  • Germany – regions
  • India – states and districts
  • Japan – prefectures and towns
  • Netherlands – municipalities
  • Norway – counties and municipalities
  • Spain – comunidades autonomas and provincias

The US cartogram is the only one at this time that was not simply a conversion from another source. It was a test of R’s new cartogram package. I took a sample US map from R’s albersusa package and created a map that distorts the states based on their 2014 estimated population. As an aside, if you have some R experience and want to explore alternatives to traditional maps, there is a lot that can be done with R that can then be converted for later use in Power BI.

us-cartogram-2014-est-population.PNG

The most important note is that nearly all of these files personally have been tested for use in Power BI. As a result, users should not encounter some of the distortion issues in Power BI that can sometimes occur when converting a Shapefile or other source into TopoJSON. In many cases, the polygons also have been simplified for performance reasons in Power BI without sacrificing much high-level detail.

Please note that I have only converted from an original source. I will not branch from an original source by making custom modifications to shapes.

Also, check out 10 Ways to Create Maps in Microsoft Power BI to see options other than the Shape Map.

Read 10 Ways to Create Maps in Microsoft Power BI.







105 thoughts on “TopoJSON Map Files for Power BI Shape Map

  1. Hi David. Do you have any uk files? I have UK Postcode (area, district, sector) and parliamentary area shp files that i am desperately attempting to get into Power BI

  2. Hi David do you have UK postcode (area, district, sector) and parliamentary areas? I have been trying to convert shp files i have for ssrs but cant get them to work in Power BI.

  3. Hi David, thanks a lot for this. Is it possible for you to please separate Canary Islands from the Spanish Map located on your repository? This will help for having 2 shape maps on same report and make a better focus on the data.

  4. We can use any .KML file and convert that into TOPOJSON file and used them in the custom shape map as well.

    This worked out for me , as i have a customized boundary for Pakistan Map.

  5. I have created a custom SHP file from scratch (using QGIS), then converted to TopoJSON using the links and help you describe – THANK YOU. The custom shapes show up in Power BI, but the shapes do not have map keys. Clicking “View Map Keys” does not bring up a dialog like it does with the built-in or your maps.

    Do you know what attribute or keys I am missing in my custom SHP file that tells Power BI what to use for map keys?

    Thank you very much.

    • Try opening the entire “Shapefile”, which is actually a compressed folder with multiple files such as .shp, .dbf, etc. in it. If you open the shp only, you only get the shapes, but the data/keys are actually contained in the dbf.

      • Thanks for the reply. Perhaps this is exposing more of my ignorance around SHP and QGIS than anything. I understand that there are the multiple files that are associated with the SHP (namely the DBF that contains a lot of that per-feature data). I am creating this SHP file from scratch, not opening an existing one. So the question is more about: after drawing some features in the QGIS design surface, how can I set the data for each feature?

        I know about the attributes for each feature, editing them and see them in the attribute table. But those are NOT what are used by Power BI in terms of map keys. I can see after conversion to TopoJSON – there is a “properties” node for each feature – it’s populated with lots of key/value pairs in legitimate/existing SHP to TopoJSON conversions I’ve seen, but nothing in that collection in my home-grown, made-from-scratch SHP to TopoJSON.

        Hope that makes sense – again, think this ends up being more of a QGIS question, so, apologize for that, just that it then impacts Power BI’s ability to see and use map keys in the TopoJSON file.

  6. I am working in my college project and planning to use shape map of power bi. Therefore,I need the Topojson file of Pakistan district. Can somebody provide me please. Thanks in advance 🙂

  7. OK – I figured this out. The QGIS side was actually working fine. Open the entire SHP “set”, including the associated DBF. Any attribute I am adding on a feature *is* getting added to the DBF.

    My mistake was when using http://mapshaper.org I was only adding the SHP file to then get converted. Now I take the extra step and add the DBF file to mapshaper as another “layer”. Nothing gets visually rendered differently in the mapshaper UI, but then when you export as TopoJson, the resulting file has the per-feature properties that are needed and interpreted by Power BI.

    Have a fully working example with various ugly feature shapes that I created from scratch in QGIS, then lit up with colors based on data, in Power BI.

    Thank you for the shoves in the right direction.

  8. Great work David!

    Could you create a map over Sweden with counties and municipalities? Would be forever grateful, thanks.

  9. Thank you very much for sharing the TopoJson files for PowerBI Shape maps. Currently I am using the Netherlands municipalties shape map.
    Recently there has been a change in de Dutch municipalities: 3 of them have merged into 1 new municipality. Could you please implement this change into the Json file?

    The old municipalities are: GM0844, GM0846 and GM 0860 (Schijndel, St Oedenrode and Veghel)
    The new one is: GM1948 (Meierijstad)

    Thank you very much!

  10. David ,

    How can I change the text coding for topo jason file in order to present the correct letters specific to the Polish language?

    I tried to use text editor to change the map Key but although I corrected letters in the text editor , they were not correct recognized in the PowerBI map keys.

      • 1. Correct spelling in Polish language: Łódzkie

        2. Topojason file – ‘ as is’ wrong spelling: “VARNAME_1″:”LĂłdzkie”}}

        3. Topojason file – ‘to be’ correct spelling to be presented in PowerBI in accordance with point 1 : “VARNAME_1″:”ĹĂłdzkie”}}

        so there is a need to change the first from “L” to “Ĺ” to have the correct spelling in PowerBI otherwise if i just write in Topojason file : “VARNAME_1″:”Łódzkie”}} I will get in PowerBI “??dzkie” name of the province instead of “Łódzkie”.

        I belive it is becasuse of text codding issue.

        Topojason file source:
        https://github.com/deldersveld/topojson/blob/master/countries/poland/poland-provinces.json

  11. Hello, and thanks for the hard work.
    Could please add Liberia, with its 15 counties and 136 districts.

    Thanks in advance

  12. Hello David,

    your work is amazing. It has helped me a lot; an invaluable help. However, I have been working with the “Spain province map”, and I would like to report a bug and suggest a change.

    Both in “province map with Canary Islands” and the “Canary Islands map” itself have an error. Half of the islands are part of the “Las Palmas” province, and the other half are from “Santa Cruz de Tenerife” province. Currently, in your great approach all of them are part of “Las Palmas”.

    They change I want to suggest is:
    -Would it be possible to add an additional name to the provinces? Actually the official name of some provinces is different. I mean, the names you used there are right, but the official name following the very official Government agencies are in this URL: http://www.ine.es/daco/daco42/codmun/cod_provincia_estandar.htm .
    These are the names most of the companies use in their databases. For example, instead of “Valencia” or “València”, the official name is “Valencia/València”, and instead “La Rioja”, the official name is “Rioja, La”.

    Thanks a lot in advance, and thanks again for your job. And sorry for my English.

    Regards!

    • It would also be great if the distance between Canary Islands and the Peninsula were smaller, the same way you moved Hawaii and Alaska nearer to the continent in the US maps, or at least add a map with this possibility.

      Thanks a lot again.

    • Hola Sergio,

      estoy intentando conseguir solo el mapa de las islas Canarias corregido con provincias, no se si me lo prodrias facilitar tu,

      Gracias de antemano,

      Un saludo

  13. Hello, and thanks for the hard work.
    Could please add Nepal, with its 14 zones and 75 Distict.

    Thanks in advance

  14. Hi david,
    I was attempting to convert a Peruvian shapefile that i had found into TopoJSON using mapshaper.
    After exporting from mapshaper and importing it into Power BI, It doesn’t show correctly.
    I wonder, Is it possible to add Peruvian map?

    shape link:
    http://geoservidor.minam.gob.pe/geoservidor/download.aspx
    (option–>Límite Departamental (Fuente: INEI-2007) – Tamaño 3Mb.)

    Thanks in advance.

  15. I have been trying to convert a shape file to TopoJSON in Mapshaper, and everything looks ok, but when i add it to PowerBI, the map dont appear as in Mapshaper. What can be the problem? Should i need the key to ben in format like ‘PT.AC’ or can be soomething like an int ‘1234’? I was trying to add the OPorto cities.

  16. Awesome work, thanks! I am using the World map and it’s working great. I can edit the JSON to remove a country completely, but is there a way that I can ‘disable’ a country in Power BI, so I have a World map that plots country data, but countries that have no data aren’t selectable? Thanks!

  17. Hi David,

    Thank you for your resources.
    I mostly work with linear networks and related data and the linear geometry is in PostgreSQL Database. Is there a best way to display such kind of geometry type into PowerBI.

    Thank you.

  18. Hey there! 😀
    I am absolutely loving the maps on here, thank you so much for this!

    I have no idea if this is simple or not, but is it possible to add the towns of Denmark?
    Some towns have data that gets combined because of the municipalities, rendering it “kind of useless”.

    If there’s something I can do myself, please let me know 🙂
    The map is still really useful, so honestly – thank you for this! 😀

    • The source i have only has municipalities. If you can find a source that provides what you want as a shapefile or geojson, please point me to it and I can look into the license and conversion.

    • In its current state, the Power BI shape map only handles polygons. That image appears to have some linestrings as well, and those will not render. Discrete colors also were not available when last I looked.

  19. Hi David,

    I really appreciate your work. This data is really useful.

    I have seen topojson map of Pakistan (Province and Division level) on your Github page.

    I have one request, can you please add the map on District level as well, please.

    It will be highly beneficial.

    Thanks in advance.

  20. Hi David, thank you for providing these files.
    Could you add a map of Belgium with its municipalities please?
    Thanks in advance,
    Diego

  21. A legend withe the color saturation scale will be an amazing (and i think needed) feature for the graphs. A graph for Venezuela will be very cool. Great work around here!!

  22. fantastic work! great to see how many countries were added
    Does anyone know were I could find .json files for Switzerland? Ideally with postal code and cantons? thanx

  23. Hi There, I have been trying to create a filled map with no luck and I hope you can point me in the right direction.

    In my data I have a column with the Sales Representatives and the regions that they represent located in US and Canada, but the filled map only recognizes the Ontario region, because the other regions has names such as Gulf Coast, Mountain Region, etc. is any way to map this?

    SalesRepID SRName Region Email Active

    1 Select Northwest Yes
    2 Sales Rep A West Central Yes
    3 Sales Rep B East Central Yes
    4 Sales Rep C North East Yes
    5 Sales Rep D Great Lales Yes
    6 Sales Rep E Mid Atlantic Yes
    7 Sales Rep F Mountain Yes
    8 Sales Rep G Western Canada Yes
    9 Sales Rep H Gulf Coast Yes
    10 Sales Rep I Southern Yes

    And for instance Great Lakes are OH, MI, WI and IL.

    • The Filled Map uses Bing to lookup place names, so it’s picking up Ontario but nothing else because it corresponds to an administrative boundary. You will not be able to make custom territories with the Filled Map but could with the Shape Map or ArcGIS Maps (if you put your territories into ArcGIS Online and use them as a reference layer).

  24. Hi David,

    I always read your contributions. Do you know when you will have the map of Venezuela available?

    Thank you!

  25. One of the more powerful aspects of shapemap is that you can create a TopoJSON of anything. But I’m having an issue understanding how to really tap that. So I’m not interested in countries, or provinces, or electoral maps, etc… I am interested in say producing a map of our office and all the cubes. Then I want to tie data to those cubes and show that. Is there a place to easily learn how to turn say a visio into topojson, or some MSSQLServer Geo functions and data into a topojson with the right keys to tie into other data.

    Any help would be greatly appreciated.

    • Unfortunately not that I’m aware of. TopoJSON is a fairly niche format. You might have luck if you can find a way to get Visio to Shapefile, which could then convert to TopoJSON. Also, try out the Visio custom visual from Microsoft and potentially avoid the workaround altogether.

  26. Hi David,
    Please let me know where can I find the topojson map for Indonesia. At Province and City level. couldnt find the city level map for indonesia.

  27. Hi David,

    Would you be able to add Australia’s map for me?

    No one seems to have created any on the web for my country so far 🙁

    Many thanks

  28. Hello,
    Great work! I got problems with the denmark-municipalities.json. When I upload it in PowerBi it causes an error everytime I hover my mouse pointer over the map. All the municipalities are not shown either, all the ones closes to Copenhagen are missing. But it might be a part of the error I dont know.
    I downloaded a map from https://github.com/ok-dk/dagi/blob/master/topojson/kommuner.topojson, which are closely the same, but it wont work either. Perhaps it’s a ME problem 🙂

  29. Hi David,

    I am so glad I came across this blog. I have been struggling to get data correctly converted to topojson.

    I am looking for an update of the South African demarcation boundaries i.e. provincial boundaries, Local Municipalities and District municipalities.

    The data is avail;able from the demarcation board : http://www.demarcation.org.za/site/shapefiles/

    I also have a question ( please excuse the ignorance), if you have converted the above mentioned boundaries, will I end up with 1 topojson file with all the detail embed therein or would it comprise of 3 different topojson filed?

    Thanks for you help.

Leave a Reply to Sergio Muñoz Cancel reply

Your email address will not be published. Required fields are marked *