# Converting Shapefiles to TopoJSON

**URL:** <https://discuss.google.dev/t/converting-shapefiles-to-topojson/119394>\
**Category:** Technical Tips & Tricks\
**Created:** [May 12, 2022, 9:28pm UTC](https://discuss.google.dev/t/converting-shapefiles-to-topojson/119394 "2022-05-12T21:28:50Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![LookerExperts](https://d3byx8b92xw3lq.cloudfront.net/user_avatar/discuss.google.dev/lookerexperts/32/109358_2.png) [@LookerExperts](https://discuss.google.dev/u/LookerExperts)\
**Post date:** [May 12, 2022, 9:28pm UTC](https://discuss.google.dev/t/converting-shapefiles-to-topojson/119394/1 "2022-05-12T21:28:50Z")

</div>

Looker uses a format for creating [map layers](https://docs.looker.com/reference/model-params/map_layer) called [TopoJSON](https://github.com/topojson/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](http://mapshaper.org/). For a drawing tool that will let you create a TopoJSON file by hand, check out [geojson.io 3](http://geojson.io/).

> _ **Note:** For pre-built TopoJSON map layers of commonly used shapefiles, see the [Looker Map Layers](https://github.com/brechtv/looker_map_layers) repository in GitHub._#  
> The Workflow

1. Visit [Mapshaper 5](http://mapshaper.org/), and drag your shape file into the window:
2. You’ll see a preview of the shape:
3. 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_key` parameter](https://docs.looker.com/reference/model-params/map_layer#specifying_a_map_layer) when creating custom map regions in Looker:
4. 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](https://help.looker.com/hc/en-us/articles/360001288168) 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](http://eric.clst.org/Stuff/USGeoJSON).

---

<div class="post-metadata">

**Author:** ![anonymous8](https://avatars.discourse-cdn.com/v4/letter/a/7cd45c/32.png) [@anonymous8](https://discuss.google.dev/u/anonymous8)\
**Post date:** [January 25, 2023, 11:10pm UTC](https://discuss.google.dev/t/converting-shapefiles-to-topojson/119394/2 "2023-01-25T23:10:54Z")

</div>

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?
