Update a table in ArcGIS Online Open Data

4112
8
09-21-2015 10:08 AM
WarrenDavison
Occasional Contributor

Hi There,

I'd like to be be able to routinely update a table that I have published to my ArcGIS Open Data site. Has anyone implemented something like this? I've been creating it as a CSV and replacing it on our web server using a script but my Open Data site only references an external download. So users are unable to query and filter the data. Has anyone been able to update a table in a way that users can still interact with it as a feature service?

Thanks,

Warren

0 Kudos
8 Replies
WarrenDavison
Occasional Contributor

Hi There,

I haven't found a solution to this yet... I briefly talked to Daniel Fenton​ and Courtney Claessens​ about this in Sand Diego this year, any chance you guys have some thoughts?

0 Kudos
DanielFenton1
Regular Contributor

Hi Warren, have you tried uploading that CSV directly to ArcGIS Online then replacing that CSV item?

0 Kudos
WarrenDavison
Occasional Contributor

Hi Daniel Fenton,

I have indeed uploaded a table as a CSV directly ArcGIS Online and I recognize that I can replace this item in order to update it with an updated source file. However, much of our data is sensor data or data that we would like to keep up to date on a daily basis. Therefore, my goal with this post was to seek out alternatives to would allow us to keep our data near real time without manually updating this information as it would be very labour intensive.

With all of our other open data that has a spatial context we've been using FME to publish directly to the ArcGIS Online feature service. Ideally I would like to be able to do something very similar.

When I did upload my CSV to ArcGIS Online I had it create a hosted table as well, would it not be possible to interact with the hosted table since it seems to have all the features of a feature service when I view the REST endpoint?

I appreciate your suggestions,

Warren

0 Kudos
DanielFenton1
Regular Contributor

Hey Warren, a couple thoughts here.

1. You can script uploads of that CSV. The best way to see how that works is to Open dev tools in your browser and visit the CSV Item page in ArcGIS Online. Then hit the upload button and replace the csv while watching the API calls your browser makes in the network activity tab. Here's the relevant documentation for that. http://resources.arcgis.com/EN/HELP/ARCGIS-REST-API/index.html#/Update_Features/02r3000000zt000000/

2. The other way you can go is adding the features to a hosted service. You can do that programmatically as well. Each time your underlying data updates, you can update the features in place, or delete all the features and upload over them. You can do all this while maintaining the same service. Here's the docs for that: http://resources.arcgis.com/EN/HELP/ARCGIS-REST-API/index.html#/Update_Features/02r3000000zt000000/

If neither of these ways work, I've got a few other ideas for you, but they're going to be more difficult and less supported.

Let me know what you think.

0 Kudos
WarrenDavison
Occasional Contributor

Thanks Daniel Fenton​ and Andrew Turner​,

I will give the ArcGIS REST API a shot, I've been using FME to upload our open data so I think I should be able to put it together with an http call.

I'll update this post when I make some progress.

On a somewhat related note, any chance either of you can explain why my CSV in ArcGIS Online seems to be missing records from the original that I uploaded?

Thanks,


Warren

0 Kudos
DanielFenton1
Regular Contributor

One idea, there is an existing bug about:

ArcGIS Online looks at the first 10 fields to determine whether an attribute is string or numeric. Any rows after that where the field contains a different type than was determined will be thrown out. The resolution is to make sure there are some string fields within the top 10 rows when updating the csv.

Does that help?

0 Kudos
WarrenDavison
Occasional Contributor

Ah yes, that bug with the CSV explains my missing records. I've since published my table as part of a feature service since I found out FME 2016 will have the ability to write to hosted tables in ArcGIS Online in the same way it can write to feature services.

Thanks for the help!

0 Kudos
AndrewTurner
Esri Contributor

As Daniel Fenton​ said, the `applyEdits` REST API call would be very useful here. Here is a Python ArcREST example​. There are also Javascript, Ruby and probably a few other examples that may be useful.

0 Kudos