I have a large feature layer hosted in ArcGIS Online. I want to select a subset by matching a field attribute to a value, and then update another field to specific value. Ideally I'd prefer not to iterate through any loops as the overall layer is > 150M records. The selection field is indexed and performs quickly, I just can't figure out how to modify/update the other field based on the selection. I've seen arcpy solutions that work with shapefiles and fgdbs, but nothing for Online.
Thanks in advance for any advice or pointers!
Solved! Go to Solution.
Hi Chuck,
I think FeatureLayer.calculate is what you are looking for.
I'm sure this is a simple issue, but it's stumped me.
The following line executes without issue:
fs_layer.calculate(where="FIPS=18039", calc_expression={"field":"VERSION", "value": "07/04/2021"})
This fails:
where_str = '"FIPS=18039"'
calc_str = '"field":"VERSION", "value":"07/10/2021"'
fs_layer.calculate(where=where_str, calc_expression={calc_str})
I've multiple ways to build the parameters to be passed, building the entire argument, varying quote schemes. What am I missing?
For this kind of thing, I'd recommend familiarizing yourself with Spatially Enabled DataFrames: https://developers.arcgis.com/python/guide/introduction-to-the-spatially-enabled-dataframe/
Your general process will look like this:
Hope this helps.
Thanks for the responses! featurelayer.calculate fit the bill. I'd skipped over it in my searches, because I'm not doing any "calculations". Once found it was an easy implementation. Thanks!!!
Chuck