|
IDEA
|
@DerekBannon22 the issue was that only fields with domains were having their values wiped when a feature was split. Fields without domains (i.e. free text) retained their values as there was no split policy applied at all. Therefore, the above fix only applies to fields with domains as they have been given the split policy after initially being published without it (a few versions ago) and the default policy applied was to wipe the values - not duplicate.
... View more
06-01-2022
05:31 PM
|
0
|
0
|
5692
|
|
POST
|
UPDATE: After the most recent updates to ArcGIS Online (June 2022) it seems the below solution doesn't work. I've tried a few variations but none of them result in the split policy either being inserted or changed. Back to not having an option but to use ArcMap to republish the service as suggested here: FAQ: Is it possible to add or edit domains after a feature service is published in ArcGIS Online? (esri.com) Posted an Idea here to give us something that works! Update "Alter Domain (Data Management)" tool to up... - Esri Community We've finally got a solution to this issue (with assistance from ESRI Support). The JSON at the service URL for the hosted feature layer needs to be updated to either include or modify the split policy so that it reflects the desired behaviour ("Duplicate"). My workflow below: 1. Go to item page > click on sub-layer > open Service URL 2. Modify the URL to see the Admin settings 3. Scroll to the bottom of the page and select the "Update Definition" option 4. Clear the lastEditDate value (replace the value with "") 5. Scroll down to the fields list 6. Update any field domains where domain is NOT null with the below line of text: "splitPolicy" : "esriSPTDuplicate", Updated JSON below: 7. Click the "Update Layer Definition" button and whalla! Your features should now duplicate attributes in fields with coded domain values when split in ArcGIS Pro 2.9+
... View more
05-27-2022
12:13 AM
|
3
|
0
|
6030
|
|
IDEA
|
This sounds like this topic: Splitting tool wipes values from AGOL feature serv... - Esri Community for which we've just sorted a solution with assistance from ESRI Support. In summary, on layers published prior to 2.9, the split policy was set to "default" and ArcGIS Pro ignored it and duplicated the attributes. After 2.9, ArcGIS Pro honoured the policy, meaning we started losing attributes. The solution to this is to edit the JSON at the service admin URL and insert/modify the split policy to "Duplicate". More details in above post.
... View more
05-26-2022
11:50 PM
|
0
|
0
|
5729
|
|
POST
|
I've modified the tool to create a new table based on the feature service and then append the data instead. It loses the GlobalID info which is a bit annoying but not overly important (couldn't figure out how to preserve it) but overall, it works for what I need. # CREATING BACKUP OF FEATURE SERVICE TABLE / RELATED TABLE
print ("Exporting backup of feature service")
Outputfs = destFC + "_" + strftime("%Y%m%d_%H%M%S")
arcpy.management.CreateTable(destGDB, Outputfs, url_fl)
arcpy.management.Append(url_fl, destGDB + "\\" + Outputfs, "NO_TEST")
time.sleep(timeout) #add time delay to allow export to complete
print (name + " feature service exported to backup GDB: " + destGDB + "\\" + Outputfs)
... View more
05-26-2022
09:37 PM
|
0
|
0
|
1525
|
|
POST
|
I've just tried running the tool directly through Pro on both machines...and it works fine - but with the below warning: This has me even more confused now as both machines are running on a Basic License, yet the data was exported as expected. I suspect this might have something to do with the python error, but I still don't understand why one will complain when the other doesn't and both are supposedly accessing the same Basic license.
... View more
05-26-2022
07:47 PM
|
0
|
1
|
1529
|
|
POST
|
Hi. Wouldn't doing this require storing the password in clear text in the script? We shifted away from doing this to remove that vulnerability from our scripts and instead storing them in a password protected environment.
... View more
05-26-2022
07:23 PM
|
0
|
0
|
1531
|
|
IDEA
|
This is a great idea. Would have been very useful in the rollout process of some new maps we've just undertaken.
... View more
05-25-2022
06:33 PM
|
0
|
0
|
1036
|
|
IDEA
|
Yes - it would be good to be able to format and validate a field so that it records and displays a valid and recognisable phone number or email address. We have come across this use case too.
... View more
05-17-2022
05:51 PM
|
0
|
0
|
1366
|
|
POST
|
I tried removing the credentials and resaving them (using the below code) but it made no difference. ### Set password and optionally verify storage
import keyring
from arcgis.gis import GIS
username = input("Enter username: ")
password = input("Enter password: ")
keyring.set_password("ArcGISOnline", username, password)
#Optionally verify password storage
print("Verifying credentials: attempting to login")
try:
pw = keyring.get_password("ArcGISOnline", username)
gis = GIS("https://org.maps.arcgis.com", username, pw)
print("Connected to the GIS - credentials verified and stored.\n\n")
except:
print("Login failed - invalid credentials stored. Re-run to update credentials.\n\n")
... View more
05-17-2022
05:47 PM
|
0
|
0
|
4288
|
|
POST
|
Hi. Interesting. I did use a code sample to use keyring to store the credentials in the first place - is this what you are referring to? I might try updating the details again anyway and see if I get a different outcome.
... View more
05-17-2022
05:25 PM
|
0
|
0
|
4288
|
|
POST
|
I've included the sample code above now. The output GDB is on a network folder (directly mapped - not using a drive letter).
... View more
05-17-2022
05:22 PM
|
0
|
0
|
4288
|
|
POST
|
Code sample below from datetime import datetime, timedelta, date
# *****Update the below 7 lines*****
name = "ArcOnline Related Table" #Name of dataset for use in error email notification
url_fl = "https://services3.arcgis.com/1GMgEwg21aGmaBQf/arcgis/rest/services/ArcOnlineRelatedTable/FeatureServer/1" # Service URL for feature layer (TABLE/RELATED TABLE ONLY) to download as feature class
destGDB = r"\\a\folder\on\our\server\Data.gdb" #The GDB where the backup feature class will be created
destFC = "ArcOnlineRelatedTable" #The backup feature class name (no spaces - user _ or CamelCase)
monthlimit = datetime.today() - timedelta(days=30) # number of days to keep daily backups
yearlimit = datetime.today() - timedelta(days=365) # number of days to keep monthly backups (1st day of month only) - everything older will be deleted
timeout = 60 # number of seconds delay to allow the export to complete
while True: #If something fails in the main script under "try", the "except" section emails a notification to the GIS Inbox
try:
import arcpy
from arcpy import env
from arcgis import gis #Instead of signing in as follows (gis = GIS("https://org.maps.arcgis.com", "Username", "Password") this breaks it up so that you are able to call the sign in details independently
from arcgis.gis import GIS
from arcgis.features import FeatureLayer
import getpass
import requests
from time import strftime
import datetime
### Access the stored password with keyring and sign into the GIS # https://community.esri.com/t5/arcgis-online-blog/connect-to-the-gis-in-python-scripts-without/ba-p/889867
import keyring
pw = keyring.get_password("ArcGISOnline", "my_username")
gis = GIS("https://org.maps.arcgis.com", "my_username", pw)
print("Connected to the GIS")
# CREATING BACKUP OF FEATURE SERVICE TABLE / RELATED TABLE
print ("Exporting backup of feature service")
Outputfs = destFC + "_" + strftime("%Y%m%d_%H%M%S")
arcpy.conversion.TableToTable(url_fl, destGDB, Outputfs)
time.sleep(timeout) #add time delay to allow export to complete
print (name + " feature service exported to backup GDB: " + destGDB + "\\" + Outputfs)
print ("Filtering past backups")
arcpy.env.workspace = destGDB
FClist = arcpy.ListFeatureClasses(destFC + "*")
for fc in FClist:
datestamp = datetime.datetime.strptime(('{}'.format(fc))[-15:], "%Y%m%d_%H%M%S")
day = (datestamp.day)
print (fc + "..........Backup date:" + str(datestamp))
if datestamp < yearlimit: #data more than 365 days old
print (" Older than 12 months: delete backup")
arcpy.management.Delete(fc)
print ("Deleted")
elif datestamp < monthlimit: #fc more than 90 days old
if day == 1:
print (" 1st of month & 4-12 months old: retain as monthly backup") #fc from 1st of Month and more than 90 days old
else:
print (" Older than 3 months and not the 1st of the month: delete backup")
arcpy.management.Delete(fc) #fc NOT from 1st of Month and more than 90 days old
print ("Deleted")
else:
print (" Less than 3 months old: retain backup")
print ("Script finished")
break # Stops script here
except Exception as e:
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
import smtplib
fromaddr = "[email protected]"
toaddr = "[email protected]"
msg = MIMEMultipart()
msg['From'] = fromaddr
msg['To'] = toaddr
msg['Subject'] = name + " backup process failed"
# Enter email body text below
body = "There has been an error backing up the feature service. Please check the script to troubleshoot any problems. Exception: " + str(e)
msg.attach(MIMEText(body, 'plain'))
server = smtplib.SMTP('smtp.org.com.au')
#No login required so this section is commented out
#server.login("youremailusername", "password")
server.sendmail(fromaddr, toaddr, str(msg))
print ("Script failed - email notification sent to [email protected]")
print ("Exception: " + str(e))
break # Stops script here
... View more
05-17-2022
05:18 PM
|
0
|
2
|
4288
|
|
POST
|
Sorry for the dodgy code sample - I normally do include a proper code sample instead of just screenshots. I suppose I was just trying to demonstrate that both were the same but showed different outcomes. Will make sure I include the code sample as well next time! I've also included a code sample above.
... View more
05-17-2022
05:11 PM
|
0
|
0
|
4292
|
|
POST
|
Hi brains trust. I need a bit of support here. I have a python script that accesses an ArcOnline feature service and downloads the data, saving it as a feature class in a local (network) GDB. I know the script works as I have it running on one PC, but on another, despite running it in the same software (IDLE for ArcGIS Pro) it fails. The error is that the parameters are not valid and the input dataset does not exist or is not supported. This is despite the same login credentials for ArcOnline being used. I'm at a loss as to why it won't work. It works fine for all my other scripts which are point/line/polygon feature services. The only difference is this one is a related table for a line feature service. The image below shows the same script and the results (left screen is the failure on the remote PC - right screen is on my PC).
... View more
05-13-2022
12:43 AM
|
0
|
14
|
5942
|
|
IDEA
|
@JohannesLindner Thanks for the reply and link to other post. I can understand how this sort of concept would have a negative impact on performance, especially on regularly changing data or map views. It would just be nice if features setup for Field Maps were honoured when you open a webmap in ArcGIS Pro or ArcOnline Map Viewer for a consistent user experience.
... View more
05-12-2022
05:11 PM
|
0
|
0
|
3793
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | yesterday | |
| 4 | Monday | |
| 1 | Monday | |
| 2 | a week ago | |
| 3 | 2 weeks ago |
| Online Status |
Online
|
| Date Last Visited |
yesterday
|