Select to view content in your preferred language

Automate batch update of layers using ArcGIS API for Python

749
1
05-16-2022 04:18 PM
BenjaminSkinner
Occasional Contributor

Hi there,

Thank you for your assistance with this potentially basic question, I am new to Python. 

I would like to automate the following workflow, so am seeking confirmation if it is possible:

  1. Pull a shapefile download from an ArcGIS hosted feature service. 
  2. Clip the shapefile.
  3. Reupload to ArcGIS Online as a hosted feature service.
  4. Automate the repetition of this process so that layers remain current.

I believe this should be possible, maybe using a combination of ArcPy and ArcGIS API for Python. Has anyone tried this?

Thank you,

Ben

0 Kudos
1 Reply
Clubdebambos
Frequent Contributor

Hi @BenjaminSkinner 

This is indeed possible. 

  1. Pull a shapefile download from an ArcGIS hosted feature service, see here.
  2. Clip the shapefile; use arcpy, see here.
  3. Reupload to ArcGIS Online as a hosted feature service; you will need to get Python to zip up the Shapefile components. Add the zip to AGOL using content manager add method, and publish as Feature Service using the item publish method.
  4. re-run 3-4 as required
~ learn.finaldraftmapping.com
0 Kudos