Looker uses a format called TopoJSON 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 shape file into the window.
- A preview of the shape will be shown:
- You can use the
infotool to inspect each region in the shapefile, to see what properties it contains. This will let you select the correct value for
property_keywhen creating custom map regions in Looker.
- Just press
TopoJSONas 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.