There are two great online tools for easily converting an ESRI Shapefile Map to GeoJSON format, or vice versa. (See also: download free shapefile maps).

The first tool is mapshaper.org, which is the recommended tool as you can also 'simplify' the map at the same time, reducing the file size. Map simplification is great for online map visualizations, since it can reduce the file size to less than 10% of the original. (See also, converting a map using ogr2ogr).

Mapshaper map conversion

Step 1. Open mapshaper.org, and click on select to attach your map files. 

Shapefile to GeoJson 1

Step 2. Your shapefile map consists of several files. Select at least the .dbf and .shp files (see below), and if available, also the .shx and .prj files. To select multiple files, hold the CTRL button while selecting the files.

Shapefile to GeoJSON 2

A note about shapefile map files: The two most important files are the .shp file (which contains the map shapes or geometry), and the .dbf file (which contains the map attributes, linking the map IDs and names to the corresponding polygons). These are the only two files required by StatPlanet to create interactive maps. Two other files which are commonly included are the .shx file (shape index, a positional index of the individual shapes / features), and the .prj file (projection format, if you are using a particular map projection).

Step 3. The map should open as in the example below. You can now export directly (see Step 5 below) or simplify the map by clicking on Simplify in the top-right menu. Make sure to select prevent shape removal as shown in the image below, otherwise map areas may disappear through the simplification process! Then, click on Apply.

Shapefile to GeoJSON 3

Step 4. Simplify the map by moving the slider to the right. The percentage simplification indicates how much the file size will be reduced. Make sure to also click on repair in the top-left corner if intersections are detected (caused by simplified adjacent geometric shapes). Usually mapshaper can fix them, but if not, you can just choose to leave them in. They will usually not be very visible, unless you zoom into the map.

Shapefile to GeoJSON 3

Step 5. Click on Export to save the map in various formats. Select GeoJSON to convert the Shapefile map to this format, and then click on Export.

Shapefile to GeoJSON 3

Ogr2ogr map conversion

The second free tool is ogr2ogr. You can convert a Shapefile map into a GeoJSON map using this tool as follows:

  1. Create a ZIP of your map files. The three files required have the extension .shp, .dbf and .shx.
    • If using Windows, hold CTRL to select the three files, right click on any of the files and from the menu select "Send to" - and then -> "Compressed (zipped) folder".
      Name the file "map.zip".
  2. Go to https://ogre.adc4gis.com, then select ‘Choose file’ in the top-left corner. Browse to and select the zipped folder you just created ("map.zip").
  3. Press the blue button "CONVERT TO GEOJSON’". The contents of the GeoJSON map will be displayed.
  4. To save it, press CTRL + S (or, depending on the browser used, select File -> Save as). Browse to where you wish to save your map, and save the file as "map.json".