How to convert shapefiles to GeoJSON

If our extensive blueprints of the Projection, 3D and Marker map templates are not enough for your needs, you can easily upload your own GeoJSON and create your own map. What if your map regions are in shapefile (.shp) format, though? Fret not, as it is very easy to convert shapefiles into GeoJSON using the free an Mapshaper.org. To convert shapefiles to GeoJSON in order to use them in our map templates,

    1
    Head over to your data source, if it lives online. For the purpose of this example, we will be making a map of Madagascar districts. We grabbed the zipped file containing various administrative regions.

    TIP: If you're getting confused with all the different file options, look for SHP in the file name. Moreover, shapefiles often are offered zipped as they are complemented by various other files that contain additional optional information.

    2
    Unzip your file. If you're using a Windows machine, you can use programs such as WinRAR, 7-Zip or WinZip. In this instance, we are unzipping only the files containing adm2, since this is the district level we want to visualize.

    3
    Head over to mapshaper.org and import your data. They can either be loose files or a ZIP  file. In this case, our ZIP file contains multiple shapefiles, so we opted for the former. You are able to upload only the .shp file or all of the additional ones for more information.

    4
    If everything looks ok, choose the Export option in the top right corner and opt for GeoJSON.

    TIP: The smaller file size, the better. If the exported file is over five megabytes, try simplifying it for quicker load times.

    5
    Import your GeoJSON file as described here and voilà! You have a map of Madagascar districts.

    TIP: In some cases, your map won't display even after exporting as a GeoJSON from Mapshaper. This is usually because your coordinate system isn't set to be WGS84. Head over to this help doc to learn how to make your coordinates WGS84.