Convert Shapefile to TopoJSON file

Convert Shapefile to TopoJSON

Convert Shapefile to TopoJSON ESRI shapefile are the binary vector data storage format for storing the location, shape, and attributes of geographic features. It is stored as a set of related files and contains one feature class. Whereas TopoJSON (topological geospatial data) is an extension of GeoJSON that encodes topology. The necessity of conversion is to reduce the size of data. While using Shapefile you have to take care of all other mandatory files such as .shx, .dbf, .prj etc. To use shape file zip file is needed so that all file can be processed together. Whereas in other data format such as geojson and topojson one file contains all the necessary information.

Convert Shapefile to TopoJSON – IGIS Map Tool

  • Go to IGIS Map Tool
  • Login if you already have a account else sign up with full name, work email id, organization name and your role.
  • Click on Converter button on upper right side shown in below image.

Convert Shapefile to TopoJSON

  • Upload you data from your system or google drive or from drop box or already uploaded in the account then select from My Drive

Convert Shapefile to TopoJSON

  • Now publish your converted file.

Convert Shapefile to TopoJSON

Here is your Topojson fileConvert Shapefile to TopoJSON

Here are other two ways to convert shapefile to topojson

Offline Method : Convert Shapefile to topojson through GDAL and then through geo2topo tool npm:

To convert shape file to topojson format offline you need to download GDAL and Node.js.  First step is to convert shapefile to geojson data format, which is done by using ogr2ogr command available in GDAL package. After successful installation check ogr2ogr availability by typing ogr2ogr in command prompt or by typing dir that will show all available directories.

convert shapefile to topojson

Now you can convert shapefile to geojson data format by using given command

  • Ogr2ogr –f Geojson file_name.json input.shp

Here –f option is used to shows the file format, which shows output file format is geojson. GDAL takes name of output file prior to input file.

Convert geojson to topojson:

Now to convert geojson data to topojson data format you have to download node.js which is available here. After successful installation you need to check npm availability using command

  • npm –check.

convert shapefile to topojson

If not available use

  • npm install -g npm-check

After this you need to install topojson-server for conversion of data that can be done by using

  • npm install topojson-server command

Now all setup is ready

Use geo2topo command to convert geojson data to topojson data

  • geo2topo –o geo.json topo.json

Here –o option is used to give the output. If command doesn’t run and gives error as no such file or directory. Then specify full path for file for both input and output. The older versions were having topojson as a command to convert geojson data format to topojson data format. Topojson is named as geo2topo command in new version.

Convert Shapefile to TopoJSON – Online Method

Mapshaper is an online tool that converts shape file to topojson data format directly. You only need to drag the shape file to site. Then use export option to convert this data into topojson format. In Mapshaper there are many option are available to simplify the geometry, which you can explore.

convert shapefile to topojson
convert shapefile to topojson

You may also look over converting kml to shapefile and shapefile to kml conversion.

I hope this article helped you in converting the file from Shapefile to TopoJSON. If you find any problem in performing operation do let me know by commenting below.

Author: Akshay Upadhyay

Owner and Director of a Private Limited company which serves individual to large scale industries in the field of Maps and GIS. He is a Gold Medalist in M.Tech(Spatial Information Technology) and owns some famous Technology blogs and website... Know more

One thought on “Convert Shapefile to TopoJSON file”

  1. Hello sir,
    I am trying to get US zipcodes topojson file from which contains shp and other dependent files when i do import and convert to TopJson file in mapshaper i see the size of it as 260MB, is there way i can get a smaller file for US zipcodes. I am trying to use this file for powerbi chorolpleth. Any help is greatly appreciated


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.