Looker will not be updating this content, nor guarantees that everything is up-to-date.
Looker uses a format for creating map layers called TopoJSON. TopoJSON stores region data in a compact format appropriate for the web. But, what if we have region data in a shapefile instead of in TopoJSON format?
You can easily create TopoJSON files from many common shapefile formats. This article demonstrates how to convert a shapefile to TopoJSON using a free online tool called Mapshaper 5. For a drawing tool that will let you create a TopoJSON file by hand, check out geojson.io 3.
Note: For pre-built TopoJSON map layers of commonly used shapefiles, see the Looker Map Layers repository in GitHub.
- Visit Mapshaper 5, and drag your shape file into the window:
- You'll see a preview of the shape:
- You can use the info tool to inspect each region in the shapefile to see what properties it contains. This will let you select the correct value for
property_keyparameter when creating custom map regions in Looker:
- Just press Export and select TopoJSON as the file format:
You're done! You now have a TopoJSON file that can be used to create a map layer in Looker. For a detailed guide to creating map layers, check out the Creating Custom Map Regions Help Center article.
Pro Tip: You can also use Mapshaper to simplify (or compress) the region data if it has too much detail. This can improve download times and rendering performance in Looker. For best results, try to keep the resulting TopoJSON under 5 MB.
These examples use a shapefile of U.S. Congressional districts, which you can find here.
I have done all of that for several different maps and it works well up to the very last point … saving the output as topojson. It outputs the code as a .json file and when I get to Power BI to create my custom map all it does is to create an outline map but with none of the detail.
That means I cannot use my data with such maps in Power BI. I did get a .topojson file from another source and that worked well.
Any advice or guidance for me?