Downloading data from web app form created in arcgis online

4893
8
03-12-2016 02:53 PM
TonyLeggett
New Contributor II

I created an online form in the recent ESRI web app course. It takes a simple input from a user. How do I retrieve the data from the cloud so that i can do further analysis on a desktop application?

GeoForm

0 Kudos
8 Replies
KellyGerrow
Esri Frequent Contributor

Hi Tony,

The Geoform app is template for form-based editing of a feature service. Prior to creating the application, you created a hosted feature service and web map. Try finding your feature service that is referenced in your geoform app and export your data to the correct format using the tool referenced in the following help documentation:Use hosted web layers—ArcGIS Online Help | ArcGIS

If you are using ArcMap or ArcGIS Pro, you can also access the feature service in the applicaiton. The above document also reviews this topic.

Cheers,

Kelly

TonyLeggett
New Contributor II

That worked well, Kelly. I created a new Geoform [GeoForm ] and new feature layer and had fun entering data via my mobile phone, then exported the feature layer as a shapefile. I downloaded the shapefile and displayed in ArcGIS 10.4 using World Street Map. Very simple to setup.

Then I setup the ArcGIS Online auto login feature via the Administrator application for ArcGIS Desktop and noticed the feature layer was a hosted service in the Catalogue. I re-entered more data into the phone and dragged the layer onto my TOC. Worked fantastic.

Once i setup a map with this layer available, i could at daily intervals reload the layer into the map via arcpy to do further processing. Is there an arcpy module for this? I'm guessing i would need to load the whole layer each time and delete the previous version as there is no live synchronisation.

Also where are the images i uploaded? They don't appear in My Content.

Cheers,

Tony

0 Kudos
TonyLeggett
New Contributor II

Actually i pressed Refresh on ArcGIS and the map correctly uploaded a new data point, so it does synchonises! This is amazing. Now, to find those images.

KellyGerrow
Esri Frequent Contributor

Hi Tony,

The images are stored as an attachment in the feature service. You have a few options to extract the attachments and view the images.

1. You can manually download the image by going to each pop up in a web map.

2. Select Export to FGDB as your exporting format (this will maintain your attachments)

3. Create a local copy of your data in ArcMap:

4. Automate downloading a File Geodatabase from the Rest API, here is a python sample: https://github.com/Esri/developer-support/blob/master/python/general-python/create-replica-and-downl...

Cheers,

Kelly

TonyLeggett
New Contributor II

Thanks Kelly. I got the manual download of attachments working from a web map. I'll have a look at the python createReplicaand Download.py script soon.

One important field i want to have added automatically to user entries via the Geoform when they press Submit is the current time, in parseable format, e.g secs since 1 Jan 1970 or UTC time or local time with UTC offset. I think it would be better if the time was inserted without the user having to enter anything.

Can you tell me how to do that?

Regards,

Tony

0 Kudos
TonyLeggett
New Contributor II

Hi Kelly, got the python script working, thanks for that. Now just to sort out the time field.

Regards,

Tony

0 Kudos
KellyGerrow
Esri Frequent Contributor

Hi Tony

There are a few ways to approach this issue.

You can add a date field in your feature service and configure your application to set this field with the current date and time. This will pre-populate the field with the current date and time for the user, which will be stored in UTC. (Read Date Functions in this documentation​ for more details about date-time formats and UTC in ArcGIS Online.) Users will be able to modify the date if they choose using this workflow.

Another option would be to enable the ability to track edits on your feature service. If this is a public app, then the username won't be recorded but the time created and edit date fields will be recorded when the form is submitted without the users knowledge. This date-time field will be stored in UTC and can also be exported using the tools above.

-Kelly

0 Kudos
TonyLeggett
New Contributor II

Thanks Kelly,

I created a new feature service layer that had a date field in ArcGIS desktop by copying the hosted feature service to a local shp file then opened the attribute table of that shp file and added a new field.

Then I zipped up the new shp file and uploaded to ArcGIS Online. At that point i got a bit confused about how to attach this new feature to my existing geoform. In the end i created a new geoform. http://arcg.is/1SaIx2i

It seems to work nicely.

The ReplicateAndDownload python script has had great usage for me to establish a local archive. But I am a bit uncertain about what is the best way to prune the online feature service. Adding lots of attachments will really cause storage problems so i thought a daily download to archive the data to a local DB followed by some feature deletion, but that's where I've become stuck.

What approach do you recommend as the best solution to keeping the online DB at a manageable level? If I start uploading empty feature services, how do i keep the geoform pointing at the right one?

Regards,

Tony

0 Kudos