POST
|
Try this: import copy
def update_cyano_status(cyanoponds_features, overlap_rows, cyanoponds_lyr):
for CCC_GIS_ID in overlap_rows['CCC_GIS_ID']:
cyanopond_feature = [f for f in cyanoponds_features if f.attributes['CCC_GIS_ID'] == CCC_GIS_ID][0]
row = overlap_rows[overlap_rows['CCC_GIS_ID'] == CCC_GIS_ID].iloc[0]
cyanopond_feature_copy = copy.deepcopy(cyanopond_feature)
cyanopond_feature_copy.attributes['Cyano_Status'] = row['cyano_risk_tier']
resp = cyanoponds_lyr.edit_features(updates=[cyanopond_feature_copy])
print(f"Attempted to update Cyano_Status for {CCC_GIS_ID} to {row['cyano_risk_tier']}. Response: {resp}")
... View more
Tuesday
|
0
|
2
|
27
|
POST
|
Hi Samantha, can you remove the try-except so it just errors out with a traceback, so we can see what line it's tripping up on? Regarding the other post, I noticed that error. I'm reaching to out Esri to ask for permission to edit it (seems like you can't edit old posts).
... View more
Tuesday
|
0
|
4
|
37
|
POST
|
For Issue #2: try this to get a list of CCC_GIS_ID values where there has not been a sample in 30 days: def query_for_no_inspection_in_thirty_days(layer):
threshold_date = datetime.now() - timedelta(days=30)
query_result = layer.query(where=f"fluorometry_date < '{threshold_date}'", out_fields='CCC_GIS_ID')
ccc_gis_ids = [record.attributes['CCC_GIS_ID'] for record in query_result.features]
return ccc_gis_ids
no_fluorometry_in_30 = query_for_no_inspection_in_thirty_days(fluorsamples_lyr)
print(no_fluorometry_in_30) Then you can loop over those CCC_GIS_ID values and update the ponds: for CCC_GIS_ID in no_fluorometry_in_30:
cyanopond_feature = [f for f in cyanoponds_features if f.attributes['CCC_GIS_ID'] == CCC_GIS_ID]
cyanopond_feature.attributes['Cyano_Status'] = 'No updated information'
resp = cyanoponds_lyr.edit_features(updates=[cyanopond_feature]) Then do the same for the microscopy. Let me know how that works.
... View more
Tuesday
|
0
|
0
|
43
|
POST
|
Hi Samantha, regarding Issues #1 and #3: It's hard to tell for sure without access to your data, but it looks to me like you're writing a value from the fluorsample layer to the cyanoponds layer to populate Cyano_Status, instead of pulling the value from the dataframe you've built. Same for prior_activity. This might put you on the right track (let me know if I misunderstood something): def update_cyano_status(cyanoponds_features, overlap_rows, cyanoponds_lyr):
for CCC_GIS_ID in overlap_rows['CCC_GIS_ID']:
cyanopond_feature = [f for f in cyanoponds_features if f.attributes['CCC_GIS_ID'] == CCC_GIS_ID][0]
row = overlap_rows[overlap_rows['CCC_GIS_ID'] == CCC_GIS_ID].iloc[0] # get the matching row from the dataframe
cyanopond_feature.attributes['Cyano_Status'] = row['cyano_risk_tier'] # add the matching status value from the dataframe to the update dictionary
resp = cyanoponds_lyr.edit_features(updates=[cyanopond_feature]) # call the update
print(f"Attempted to update Cyano_Status for {CCC_GIS_ID} to {row['cyano_risk_tier']}. Response: {resp}")
... View more
Tuesday
|
0
|
6
|
34
|
POST
|
Old thread but thought I'd post this here in case Google brings anyone here. There is an update_definition method in the arcgis.features.managers module of the Python API, but it's been inconsistent for me. So I just make the call through the REST API. The code below enables layer optimization for the specified feature service item and layer index: from arcgis.gis import GIS
import requests
import json
gis = (portal_url, username, password)
item_id = '' # item id of feature service wih layer to optimize
item = gis.content.get(item_id)
layer_index = 0 # layer index in feature service for layer to optimize
update_def_url = f"{item.layers[layer_index].url}/updateDefinition".replace(r'rest/services',r'rest/admin/services')
token = gis._con.token
data = {'token':token,
'f': 'json',
'async': 'true',
'updateDefinition': r'{"multiScaleGeometryInfo":{"levels":[]}}'
}
result = requests.post(update_def_url, data=data, timeout=10)
status_url = f"{result.json().get('statusURL')}?token={token}&f=json"
status = None
while not status == 'Completed' and not status == 'Failed':
status = requests.get(status_url, timeout=10).json().get('status')
print(f"Optimization status: {status}")
time.sleep(10)
else:
if status == 'Completed':
logging.info(f"Layer drawing optimized successfully for {item.title} ({item.id})")
if status == 'Failed':
status = requests.get(status_url, timeout=10).json()
logging.error(f"Layer optimization failed for {item.title} ({item.id}). Status: {status.json()}")
... View more
2 weeks ago
|
0
|
0
|
28
|
POST
|
Thanks Brett, I added a vote for your idea. It's interesting that the status of your bug report is "In Review". Perhaps that's a hopeful sign.
... View more
3 weeks ago
|
0
|
1
|
75
|
POST
|
Yep, sounds like a job for Python. Feel free to tag me or PM me if you get stuck. My post from 2020 is a bit outdated now that you can schedule tasks in Notebooks (no need to have a computer always on, or use a third-party cloud environment).
... View more
3 weeks ago
|
0
|
0
|
103
|
POST
|
Just noticed that you have matching IDs (I missed that on the original post because I saw you were doing an intersect). In that case, a joined view should work. Did you set the join operation as one-to-one, only keep the first matching record, then sort by EditDate descending?
... View more
3 weeks ago
|
0
|
2
|
125
|
POST
|
I see - it sounds like you're trying to populate values in bulk for the whole table. If so, then you are correct, Forms is not meant for this. What you should expect from Forms is that when you go to edit a feature in the map (e.g., by clicking on it then clicking Edit in the popup), the value for the field where your expression is configured will be pre-populated with the value returned by the expression. The Arcade visualization profile doesn't support FeatureSets, so I don't know of a way to dynamically set the symbology in the way you're describing. Attribute Rules are not supported on hosted feature layers, so that's out as well. AFAIK, you'll need to calculate the values you want to use for symbology, either manually or with Python.
... View more
3 weeks ago
|
0
|
4
|
143
|
POST
|
With the pending deprecation of Field Maps on Windows, we're looking for a solution for distributing offline maps to rural public safety staff. Windows is an absolute requirement (they will be viewing maps on mobile data terminals in patrol cars), and they need to be able to see their position on the map (they have a GPS dongle plugged into the MDTs). Explorer meets all of these requirements, and as far as I can tell, is the only Windows app that does.* It still looks great and does everything we need it to do. According to ArcGIS Explorer (Windows) Life Cycle | Esri Support, Explorer is still in General Availability on Windows, and according to Deprecation: ArcGIS Explorer Deprecation (esri.com), there are no plans to deprecate Explorer on Windows. I'm hoping to gather some information/opinions on whether this is a viable solution, and how long we might expect Explorer to remain supported, since the life cycle page shows no retirement date. *We could kind of jam this into Survey123, but it's not designed for this and therefore has some limitations for our purposes.
... View more
3 weeks ago
|
2
|
4
|
180
|
POST
|
Have you tried logging those variables to the console, e.g., Console(RelatedReads) etc.? That might help you understand the values being generated by the expression to make sure your logic is getting the inputs you expect.
... View more
3 weeks ago
|
0
|
7
|
212
|
POST
|
I did some more testing, and our 4x map looks great on Explorer on Windows 11 without any modification. Arcade expressions work (including FeatureSets). Multiline labels and layer grouping from hosted feature layers. Created an MMPK and it works almost as well, but without curved labels. @RyanUthoff: ArcGIS Explorer (Windows) Life Cycle | Esri Support shows Explorer still in General Availability, which means patches/bugfixes should happen, maybe. It would be great if someone from Esri could confirm. It looks to still be fully supported, although I know the official recommendation is to move to Field Maps on iOS/Android. FWIW, our use case is a sheriff's office needing offline maps on their Windows-based mobile data terminals (ruggedized laptops mounted in patrol cars). Moving to Android or iOS just isn't possible.
... View more
3 weeks ago
|
1
|
0
|
130
|
POST
|
I've tested Explorer on Windows 11. It seems to work fine and is available from the Microsoft Store. I'm afraid to deploy to any production workflows since all the support links for Explorer in the Microsoft Store redirect you to Field Maps docs. It's unclear whether Explorer is still supported by Esri, or if so, what the Explorer support lifecycle might look like. But we are in a bit of a bind without a Windows 11 option that can show device location with offline capability.
... View more
3 weeks ago
|
0
|
1
|
143
|
POST
|
Thanks again Doug, very good point. I'm planning to use the pulldata("@property", 'mode') calculation on a hidden/null question to assign the survey mode to a variable, then use that variable in the relevant column for the second geopoint and the lat/long fields populated from it (e.g., ${survey_mode}!='edit')). This way those fields will only be calculated on initial submission.
... View more
04-12-2024
06:20 PM
|
1
|
0
|
169
|
POST
|
@DougBrowning Setting the default to 0,0 still placed the second geopoint on the ¢er= value. However, setting calculate to null and bind::esri:parameters to calculationMode=always (then making the second geopoint required) worked for me. Thanks for putting me on the right track.
... View more
04-12-2024
02:30 PM
|
1
|
2
|
180
|
Title | Kudos | Posted |
---|---|---|
1 | 3 weeks ago | |
2 | 3 weeks ago | |
1 | 04-12-2024 06:20 PM | |
1 | 04-12-2024 02:30 PM | |
6 | 03-25-2024 11:32 AM |
Online Status |
Offline
|
Date Last Visited |
yesterday
|