POST
|
Hi Michael, Please share a link to the Esri information about that bug. Best, Stacey
... View more
01-29-2024
12:17 PM
|
0
|
1
|
177
|
POST
|
Hello - I use this Python script to upload XML, ArcGIS formatted metadata to items in AGOL. The items are registered feature layers of ArcGIS Server map services. The XMLs have been edited to enable a zipped file geodatabase download in our AGOL Open Data Site. The geodatabase download only becomes available in Open Data after I run the script and then manually open the AGOL metadata editor for that item and click the 'save' button. I haven't found a way to script the Metadata Editor 'save' function with the ArcGIS API for Python. Anybody know how? Thanks! Stacey import os, csv
from arcgis.gis import GIS
#Set path, user ID, and password to AGOL account
userid = "username"
gis = GIS("AGOL URL", userid, "password")
#Set variables
userfolder = "folder name"
csvdata = "path to csv"
xml_path = "path to xml folder"
#Get a list of items in AGOL folder
user = gis.users.get(userid)
itemslist = user.items(folder=userfolder, max_items=500)
#Iterate through AGOL items and CSV records
for item in itemslist:
csv_reader = csv.DictReader(open(csvdata))
for row in csv_reader:
namefield = row['AGOLTitle']
xmlfield = row['XMLName']
add_xml = os.path.join(xml_path, xmlfield)
#Update AGOL items that match CSV records
if item.title == namefield:
item.update(metadata=add_xml)
else:
continue
del item
... View more
03-01-2021
03:28 PM
|
0
|
0
|
777
|
POST
|
Hi Egge-Jan, I tried Decode and it only returns the default value. Here's the full expression: And the resulting pop-up: I also tried this expression and it also only returned the default value: I've also tried Replace but only the first value got replaced. Thanks for the suggestion! Stacey
... View more
07-28-2020
03:15 PM
|
0
|
4
|
2084
|
POST
|
Hello - I'm trying to change multiple values in a field for each record (e.g., SK, CO, BT) to different values (e.g. Sockeye, Coho, Bull Trout) to display in a web map pop-up using Arcade. I've tried this Arcade expression but it returns the error: Execution Error:Field not Found: var spcode = Dictionary('SK', 'Sockeye', 'CH', 'Chum', 'PK', 'Pink', 'CO', 'Coho', 'CK', 'Chinook', 'SH', 'Steelhead', 'SRCT', 'Sea run cutthroat', 'RT', 'Resident trout', 'BT', 'Bull Trout'); var values = Split($feature.Species, ','); var numcode = Count(values) var spindex = 0; var splist = []; if (numcode > 0) { for (var i in values) { splist[spindex] = spcode[values]; ++spindex; } } return splist; If the array is a variable, this expression works in the Arcade Playground: var spcode = Dictionary('SK', 'Sockeye', 'CH', 'Chum', 'PK', 'Pink', 'CO', 'Coho', 'CK', 'Chinook', 'SH', 'Steelhead', 'SRCT', 'Sea run cutthroat', 'RT', 'Resident trout', 'BT', 'Bull Trout'); var values = ['CH', 'BT', 'SH']; var spindex = 0; var splist = []; for (var i in values) { splist[spindex] = spcode[values]; ++spindex; } return splist; I've also tried a function to create an array of the field values, similar to the second expression, but get the same error as the first expression: function fieldarr(inField) { var values = Split(inField, ','); var num = Count(values) var cdindex = 0; var cdlist = []; if (num > 0) { for (var i in values) { cdlist[cdindex] = values; ++cdindex; } } return cdlist; } var spcode = Dictionary('SK', 'Sockeye', 'CH', 'Chum', 'PK', 'Pink', 'CO', 'Coho', 'CK', 'Chinook', 'SH', 'Steelhead', 'SRCT', 'Sea run cutthroat', 'RT', 'Resident trout', 'BT', 'Bull Trout'); var fieldlist = fieldarr($feature.Species) var numcode = Count(fieldlist) var spindex = 0; var splist = []; if (numcode > 0) { for (var i in fieldlist) { splist[spindex] = spcode[fieldlist]; ++spindex; } } return splist; I'm stumped - any help would be greatly appreciated!
... View more
07-28-2020
01:48 PM
|
0
|
6
|
2201
|