Creating & Importing Data for ArcGIS

geographic formatting & spatial dataframes

Sourcing Proper Data

Let’s explore ArcGIS’ native data creation & import settings before running some more visualizations.

Double Check your Data

This is all made quite simple with Jupyter notebooks; nothing more than df = pd.read_csv(‘../data/covid_data.csv’) and you’ve got a brilliant dataframe.

Image for post
Image for post
Image for post
Image for post

Fitting Into the Pipe

Now we’ve got workable data and know (generally) what it’s about, we can put it into ArcGIS.

from arcgis.gis import GIS
# instantiate new GIS object
gis = GIS("https://www.arcgis.com", 'username', 'password')
# import dataframe as feature collection
covid_fc = gis.content.import_data(df)
import json# create feature_collection_property dict
covid_fc_dict = dict(covid_fc.properties)
# convert to JSON
covid_json = json.dumps({'featureCollection':{"layers": [covid_fc_dict]}}) # careful with the double nesting format
Image for post
Image for post

Written by

data scientist, machine learning engineer. passionate about ecology, biotech and AI. https://www.linkedin.com/in/mark-s-cleverley/

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store