Forum Discussion
Importing TopoJSON file to create shape map: what Next?
- 6 years ago
Ignore the other thread that you mentioned. You are trying to make this way too complicated.
You do not need to know anything about TopoJSON to make this work. Please re-read my previous answer (with the following additions/clarifications).
You need two things to make shape map visualisations:
1: A topoJSON file of the place/area/shape you are going to use. If you are lucky, a nice person on the internet will already have made one that will work for your purposes. It looks to me that you already have this because you have posted a picture of it rendering correctly on GitHub. So you are halfway there (and all you had to do was search the web).
2: Some data that relates to the shape you already have (in 1: above). This is not extracted from the TopoJSON file. It is the data that you want to connect to the shape file. See my previous post's example of "Number of coffee shops in each barrio". Your data will relate to barrios of Barcelona in some way but it will not come from editing the topojson. Remove this idea from your mind.
Get the data in 2: into your powerbi file.
Drag a shapemap on to the report surface.
Add a field to the Location field well.
Use the "+ Add map" in the format section to link the shapefile in 1:
Add another field to the Color Saturation field well.
That's it.
I highly recommend that you follow the instructions here
Ignore the other thread that you mentioned. You are trying to make this way too complicated.
You do not need to know anything about TopoJSON to make this work. Please re-read my previous answer (with the following additions/clarifications).
You need two things to make shape map visualisations:
1: A topoJSON file of the place/area/shape you are going to use. If you are lucky, a nice person on the internet will already have made one that will work for your purposes. It looks to me that you already have this because you have posted a picture of it rendering correctly on GitHub. So you are halfway there (and all you had to do was search the web).
2: Some data that relates to the shape you already have (in 1: above). This is not extracted from the TopoJSON file. It is the data that you want to connect to the shape file. See my previous post's example of "Number of coffee shops in each barrio". Your data will relate to barrios of Barcelona in some way but it will not come from editing the topojson. Remove this idea from your mind.
Get the data in 2: into your powerbi file.
Drag a shapemap on to the report surface.
Add a field to the Location field well.
Use the "+ Add map" in the format section to link the shapefile in 1:
Add another field to the Color Saturation field well.
That's it.
I highly recommend that you follow the instructions here
Success! Thank you for your patience and help!!
I can't believe that it was really that simple! I guess I was wired into thinking I needed to set coordinates (Lat/Long), similar to what I have done in the past with the simple map visual.
As you say, it was as simple as adding data to the visual data bucket from another source, clicking on the "+ Add Map" option under the Shape section in the format pane, navigate to the topoJSON file and voilĂ ! Pretty cool!
Thank you again for your time and assistance!
- HotChilli6 years agoCommunity Champion
Great. I'm glad you worked it out.
One thing more - I notice the grey areas on the shape map. This means either :
a) there is no data for those areas (which is fine) or
b) powerbi can't make a link between the shape map and the data (for just the grey areas). There is some sort of hidden magic that powerbi uses to link the shapemap with the data you add. It'll use one of the fields in 'Show map keys'. Sometimes fields don't match up due to spelling or data type mismatches or errors in the shapemap file. You can fix them by editing the data or editing the topojson file. This is something to be aware of.
- PaulDBrown6 years agoCommunity Champion
Thanks again. I did in fact see this when I finally created the shape map. It's just that there are some fields in the location which don't exactly match between both sources. Easily fixed.
Much appreciate it.