Corrupted View layers after an update to the parent layer

1059
10
02-22-2022 01:42 AM
JoshNock1
New Contributor III

I have noticed recently that when I make an update to a layer on ArcPro and overwrite the layer onto AGOL all linked View layers return with data errors.
I have tried using ArcGIS Online Assistant to copy over the JSON but the error still persists. Creating a new View layer works but it is not sustainable to keep on replacing layers in maps.

Has anyone else experienced this issue? and managed to find a solution or workaround?

Many thanks

 

10 Replies
jcarlson
MVP Esteemed Contributor

We've seen this plenty of times ourselves, and it was issues like this that caused us to stop overwriting layers unless absolutely necessary. Our rule of thumb is that unless you're changing the number/order of the layers in the service or altering relationship classes, you ought to avoid overwrites.

Why do you need to overwrite your layer? Making simple schema changes or overwriting the features in a layer can be done without republishing the service itself. For the former, make any changes to your fields from AGOL itself. For the latter, you can use the truncate and append GP tools, or the Python API.

- Josh Carlson
Kendall County GIS
JoshNock1
New Contributor III

Thanks Josh. A lot of the time it is updating data that changes daily, weekly or monthly. So unfortunately it has to be updated.

 

Is this something that you have noticed recently?
We have had months of being able to update layers, but only recently we have experienced issues

0 Kudos
jcarlson
MVP Esteemed Contributor

Can you clarify what you mean by that, though? Updating your data and completely overwriting a service are very different operations, and usually folks only need the former.

We were seeing this happen even a couple years ago, and the update process was able to execute without issue a number of times before "going bad".

- Josh Carlson
Kendall County GIS
0 Kudos
AndyWells
Occasional Contributor II

I was reading this post with interest. I have recurring need to overwrite a large parcel layer on a weekly basis. This layer has 30,000+ records, and is published from a local FGDB with a join to a database. So my usual workflow is to make edits to the local FGDB layer, with the join retrieving new attribute data. I export this to a combined local feature layer (polygons + joined attributes). When I am ready, I overwrite the online feature layer. I have tried to drop and add all the records in the online feature layer, to keep from overwriting, but it is extremely slow and not feasible. Is there another method I should be looking at? Like you, I hate overwriting services, but I can't see how to work around it.

0 Kudos
jcarlson
MVP Esteemed Contributor

What exactly is that "drop and add all the records" process like? We use python, and it handles truncating and appending tens of thousands of rows in only a few minutes.

- Josh Carlson
Kendall County GIS
0 Kudos
AndyWells
Occasional Contributor II

I meant using the "Delete Features" to erase the contents of the online layer, and then "Append" in ArcGIS Pro. The last time I tried this, (admittedly a while ago) it was many hours to complete the process. And I basically have to delete and append all 30,000+ features each time.

I had not really tried anything with Python, although I am open to it. I'd appreciate any insight on this. It has been a real problem for us. 

0 Kudos
jcarlson
MVP Esteemed Contributor

At the very least, use the arcgis Python API, then use FeatureLayer.manager.truncate() to delete the existing features, as it will go much faster. Using FeatureLayer.edit_features(adds=[an array of features]) will probably work better for the append, too.

Personally, we try avoid a full overwrite. The python library pandas can make comparisons between two dateframes, too. When we can, we look at the source and destination as dataframes, and identify which of the rows have changed, if any, and only overwrite the values for the changed features. Having editor tracking on the layers can help identify edits, too. If the data permits, your update process can selectively update, add, and delete the features that need it, leaving the rest alone.

- Josh Carlson
Kendall County GIS
AndyWells
Occasional Contributor II

Thanks for that! I knew the arcgis API existed, and was better to use for this sort of thing than ArcPy, but I had never investigated it that much. I didn't realize the difference in speed. I found another post with a script and tried it, and it worked really well. So I really appreciate the help.

0 Kudos
TiffMaps
New Contributor II

Hi Josh, I have often had issues with overwriting layers so your comment is helpful to see. Do you have any suggestions on how to approach domain changes? You can create the domain in AGOL, but longer lists can be particularly challenging, and sorting is not supported in AGOL and can be buggy in Pro. 

0 Kudos