Skip to main content

A simple wrapper for interacting with the ArcGIS Online REST API.

Project description


A simple wrapper for interacting with the ArcGIS Online REST API.


This project is geared towards developers who just want to get data into the ArcGIS Online as easily as possible. The REST API can be pretty confusing if you aren't familiar with ArcGIS jargon, so we created this simple wrapper to abstract some of the difficulties with creating resources and adding data.


First you will need an ArcGIS Online account and an app registered on the Developer portal.

Then you will need to know a thing or two about ArcGIS lingo.

Feature service:

  • "Feature services allow you to serve features over the Internet and provide the symbology to use when displaying the features."
  • A feature service can store many feature layers.

Feature layer

  • "A feature layer is a grouping of similar geographic features, for example, buildings, parcels, cities, roads, and earthquake epicenters."
  • A feature layer can store many geometric features.


  • "Feature classes are collections of common features, each having the same spatial representation, such as points, lines, or polygons, and a common set of attribute columns."


pip install simple-arcgis-wrapper


0. Import

import simple_arcgis_wrapper as saw

1. Identify yourself

You will need a registered app and tokens obtained through the OAuth flow. Check out this link to learn more about setting up OAuth.

api = saw.ArcgisAPI(
    access_token='ACCESS_TOKEN',   # access token obtained from user
    refresh_token='REFRESH_TOKEN', # refresh token obtained from user
    username='USERNAME',           # username obtained from user
    client_id='CLIENT_ID'          # your OAuth app's client ID

2. Create a feature service

A feature service is like a container for many feature layers.

service ='NAME', 'DESCRIPTION')

print(,, service.url) # service is a FeatureService object

3. Create a feature layer in the feature service

A feature layer is where you actually store your geometric features like points, lines and polygons.

# First specify additional attribute columns.
fields = saw.fields.Fields()
fields.add_field('Date', saw.fields.DateField)
fields.add_field('Name', saw.fields.StringField)
fields.add_field('Altitude', saw.fields.DoubleField)

layer =
    layer_type='point',                      # point, line, or polygon
    name=name,                               # name of the layer
    description='My test description',       # description of the layer
    feature_service_url=feature_service.url, # the URL of the feature service that the layer will be added to
    fields=layer_fields,                     # a Fields instance
    x_min=10.0, y_min=10.0,                  # min bounding box parameters
    x_max=20.0, y_max=20.0,                  # max bounding box parameters
    wkid=4326                                # well-known ID spatial reference

print(,, layer.url) # layer is a FeatureLayer object

4. Add a point to the feature layer

# Specify an attributes with keys that match the layer's columns
attributes = {
    'Date': '2020-01-01 15:30:45',
    'Name': 'John Doe',
    'Altitude': 12.5

point_feature =, lat=20.0, layer_url=layer.url, attributes=attributes)

print( # point_feature is a Feature object

5. Delete a feature layer[], service.url)

6. Delete a feature service


Before testing, configure the following environment variables:


By running the tests you will incur a (very) small charge to your account.

python -m unittest tests/test*.py


  • Casey Slaught - Lead developer - Caracal


This project is licensed under the MIT License - see the LICENSE for details

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

simple-arcgis-wrapper-1.0.2.tar.gz (9.9 kB view hashes)

Uploaded source

Built Distribution

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page