Looker uses a format called TopoJSON 2 to store region data in a compact format appropriate for the web.
TopoJSON files can be easily created from many common shapefile formats.
If you’ve already found region data, but it’s not in the right format, you can easily use a free online tool called Mapshaper 5 to convert it; we show you how below (for a drawing tool that will let you create a TopoJSON file by hand, check out geojson.io 3):
- Visit Mapshaper 5 and drag your shapefile into the window.
- A preview of the shape will be shown:
- 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_keywhen using your map data 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.
Pro Tip: Mapshaper can also be used to simplify (or compress) the region data, if it has too much detail. This can improve download times and rendering performance in Looker.
Try to keep the resulting TopoJSON under 5mb for best results.
These examples use a
.shpfile of U.S. Congressional districts found here.