Upload a Shapefile to ArcGIS Online Using arcpy

3443
7
09-21-2015 08:01 AM
JacobSnyder2
New Contributor III

Hello,

I work for a county government, and we will soon be having a team-building exercise in which we will be engaging in an intra-departmental scavenger hunt. As a GIS Technician, I have been assigned the task of creating a custom web application in which users can mark their locations and a brief description of themselves on the map. I have begun creating this application using WebApp Builder. In respect to creating the functionality that I have described above, I have decided to create a Python script tool that accomplishes this functionality, uploading it to our ArcGIS Online organizational account as a geoprocessing service, and then incorporating this geoprocessing service into the web application as a customized widget. I am currently having trouble figuring out how to use arcpy to upload a shapefile that is on disk to an ArcGIS Online organizational account, and add this shapefile to the web map that is servicing the application. Could anyone help me out with this process? Any advice would be appreciated. Thanks so much.

-Jacob

0 Kudos
7 Replies
BlakeTerhune
MVP Regular Contributor

Couldn't you just create the layer in ArcGIS online and have them edit it in ArcGIS Online? They could even use the Collector app on their mobile device to make edits. What's the need to automate uploading the Shapefile?

EDIT:

You could also look into ArcREST.

0 Kudos
JacobSnyder2
New Contributor III

The reason for automating is because I am trying to provide this functionality to non-GIS users in a user friendly format. The Editing tool is an option though. I added an editable shapefile to the web map, but when I tried to add the actual editing widget, it said that there were no editable layers in the map.

0 Kudos
BruceHarold
Esri Regular Contributor

Hi

If you make the shapefile a layer in ArcGIS Pro  then arcpy can push editable data up easily:

CreateWebLayerSDDraft—ArcPy | ArcGIS for Desktop

Regards

JacobSnyder2
New Contributor III

Bruce,

I appreciate your help, but I do not have access to ArcGIS Pro. Thanks again.

-Jacob

0 Kudos
BlakeTerhune
MVP Regular Contributor

You may need to enable editing on the layer. If you still have trouble, maybe try using a file geodatabase instead of a Shapefile.

Considerations for adding Shapefiles—ArcGIS Online Help

0 Kudos
JacobSnyder2
New Contributor III

Blake, ArcREST seemed promising but I am working off of ArcGIS 10.1. I noticed that ArcREST requires at least 10.2

0 Kudos
JacobSnyder2
New Contributor III

If it helps, I work off of ArcGIS 10.1. ArcREST seemed promising but it requires that you have at least 10.2

0 Kudos