Tutorial: Converting Shapefiles to JSON with ArcGIS Pro

by | Jan 18, 2022

In this tutorial, we’ll cover how you can do data conversion with ArcGIS Pro’s Conversion toolset.

Data conversion means that you will change data from one file format to another. This is often required when importing or exporting data out of Pro and use it in another environment. We’ll have a look at converting a shapefile to JSON format, using Pro’s Conversion tools.

Pro’s Conversion toolset contains seventeen different tools that not only convert between different file formats, but also between data types (such as raster to vector and vice versa). Also included are tools and scripts to convert to Esri-specific data formats such as GeoDatabase, GeoPackage and the Shapefile. Newly added to Pro 2.9 are the PDF to TIFF geoprocessing tool, the Features to Graphics and the Graphics to Features tool.

It should be noted that the Conversion toolset is not exhaustive: there are many different file formats for spatial data and only a few of them are included in the Conversion toolset. There’s also the ArcGIS Data Interoperability extension for Desktop, which is an integrated spatial extract, transform, and load (ETL) toolset that runs within the geoprocessing framework using Safe Software’s FME technology. This requires a separate license and is not covered here.

Step 1: Download the data and create a new, empty project in Pro

Open Pro and create a new project using a map template. We’ll be using the Natural Earth quick start kit dataset, that can be downloaded here. Add a folder connection by clicking on the folder icon in the Catalog pane and choose the data folder with the downloaded dataset. Add the ne_110m_admin_0_countries.shp file to the map window, which is found in the 110m_cultural folder.

Step 2: Find the Conversion geoprocessing toolbox Find the conversion geoprocessing toolbox by clicking the Analysis tab on the ribbon interface and then clicking the Tools icon. Dock the geoprocessing window to the left of the screen to keep it from closing. Open the Conversion toolbox and have a look at the different tools:

Step 3: Convert vector features to JSON

Now that we have a specified dataset (shapefile) containing a set of vector features, we can convert it to other file formats. We’ll first convert them to JSON (short for JavaScript Object Notation), a file format where all features are stored as JavaScript objects. We’ll use the Features to JSON toolset for this. In the online tool documentation, we can read that JSON and GeoJSON are text-based, lightweight interchange data formats that are used to share GIS data between ArcGIS and other systems. These formats are language-agnostic, and most programming languages provide libraries to read, manipulate, and write JSON and GeoJSON. To convert the features inside the shapefile to a json format, double click the Features to JSON tool and set the input features as displayed below:

Specify a different output file name if necessary, or use the default option. Leave the two check boxes unchecked: choosing the “Formatted JSON” option will format the JSON output in human-readable way, which is not recommended when using the files for production purposes. The second option, GeoJSON will use a default spatial reference of WGS1984 for the JSON output, but this is not necessary for our example which already has an EPSG projection of 4326. This projection refers to the WGS 1984 coordinate system. Click “Run” to create the output. Find the output JSON file in the project folder:

Opening up the file in a code editor will show all the data from the attribute table in JSON format. I’ve highlighted the spatial reference info to be sure that is also included in the standard JSON format when converting a shapefile:

Categories

Recent Posts

Eric van Rees
Eric van Rees is a freelance writer and editor. His specialty is GIS technology. He has more than eight years of proven expertise in editing, writing and interviewing as editor and editor-in-chief for the international geospatial publication GeoInformatics, as well as GIS Magazine and CAD Magazine, both published in Dutch. Currently, he writes about geospatial technology for various clients, publications and blogs.

Sign up for our weekly newsletter
to receive content like this in your email box.