Load TopoJSON:






Add TopoJSON data to the map

This sample shows how to add TopoJSON data to the map, by converting it into GeoJSON in a Web Worker so that map can easily render it. TopoJSON data is an extension of GeoJSON that encodes topology. This is ideal for reducing the file size of polygon data sets that that share edges. This sample uses the open source topojson-client library for converting the decoding the TopoJSON data into GeoJSON which can be easily add to the map. It also makes use of the open source Catiline.js library which makes working with web workers easier.

Note: Not all file and mime types are enabled in all servers. If using .NET, it is recommended to add the following to the web.config file:

<system.webServer>
  <staticContent>
    <mimeMap fileExtension=".topojson" mimeType="application/json" />
  </staticContent>
<system.webServer>