|
POST
|
If you copied it exactly, not surprising you got an error as I had a mistake in the code. AGOL_SignTable = arcpy.FeatureSet()
AGOL_SignTable.load(L0Sign) Basically, I define AGOL_SignTable as an arcpy feature set, then the next line loads the data from the hosted feature server layer URL into the arcpy FeatureSet. Once loaded, I can treat AGOL_SignTable as any other FGDB featureclass. I have not tested all functions on it, but works well with search cursors, arcpy calculate and arcpy append. R_
... View more
08-05-2024
08:30 AM
|
0
|
4
|
2638
|
|
POST
|
If there is a selection on the data, the Copy Features tool will only copy the selected features. With arcpy, you should be able to iterate through you layers and select by location, then, while the selection exists, copy features to the other geodatabase, then on to the next layer in the list. R_
... View more
08-01-2024
04:08 PM
|
0
|
0
|
1958
|
|
POST
|
Yes, or map viewer. See my post here from earlier today (I show both). R_
... View more
08-01-2024
10:25 AM
|
0
|
2
|
1309
|
|
POST
|
This button in the map viewer will open the Form editor: Then, highlight the field you want to calculate the value for (in this case ALT_NAME): and click + New expression. (The check mark next to PopulateFullName means that expression is attached to the selected field) And this is what my expression look like: Then Click OK and save the map. You can also edit the Form in Field Maps Designer: R_
... View more
08-01-2024
09:51 AM
|
2
|
2
|
3818
|
|
POST
|
Not sure if you are trying to sync both ways, or why you are wanting to use the arcpy.MakeFeatureLayer_management as the bug references, but maybe my process is different enough it won't work for you. In my case, I have a local eGDB that I published to AGOL for data collection in a Field Maps app. So, the data is collected in AGOL hosted feature service, but I need to keep the local copy up to date. I have been using code similar to the following for the last 2 years and have had no issues with it. Basically, I establish a search cursor on the AGOL and local datasets and load the GlobalIDs into a list. It also compares the two lists, and if there are GlobalIDs in the AGOL list, but not the local list, it means those features need to be copied (appended) over. (So, we are only coping the 'missing' features, not the entire dataset) Then I use arcpy.management.Append to append the missing features to the local data using a where clause that is an IN() with the GlobalID's from the missing list like so: import arcpy
Signs = r'\\path_to\\SignDatabase.sde\SignsDatabase.DBO.Signs' # path to the signs local eGDB FC
L0Sign = r"https://services3.arcgis.com/itemID/ArcGIS/rest/services/HostedFeatureService/FeatureServer/0" # URL to AGOL hosted feature
AGOL_SignTable = arcpy.FeatureSet() # define AGOL_SignTable as FeatureSet
AGOL_SignTable.load(L0Sign) # Load hosted feature into AGOL_SignTable
SignList = [] # empty list for local GDB features
AGOLSignList = [] # empty list for AGOL features
with arcpy.da.SearchCursor(Signs,"GlobalID") as cursor: # Get list of GlobalID's from SDE data
for row in cursor:
SignList.append(row[0])
with arcpy.da.SearchCursor(AGOL_SignTable,"GlobalID") as cursor: # Get list of GlobalID's from AGOL data
for row in cursor:
AGOLSignList.append(row[0].upper())
if (row[0].upper() or row[0]) not in SignList: # and if not in local SignList, append to AddSignList
AddSignList.append(row[0])
ith arcpy.EnvManager(preserveGlobalIds=True, maintainAttachments = True):
if AddSignList: # if any 'missing' features in AddSignList, then append to local eGDB
print("adding " + str(len(AddSignList)) + " Sign Records")
Signs = arcpy.management.Append(inputs=[L0Sign], target=Signs, schema_type="TEST", field_mapping="", subtype="", expression="GlobalID IN ('" + '\',\''.join(AddSignList) + "')")[0]
else:
print("No Signs to add") I can't say the same for any scripts I run using the API python (seem to get a lot of timeout errors, etc. and have to code accordingly). However, I have had good success with the API code here to export an AGOL hosted feature service to a FGDB (including attachments) and download to local folder without having to script any mouse clicks. R_
... View more
08-01-2024
09:40 AM
|
0
|
6
|
2672
|
|
POST
|
To sync from AGOL data to the local database, I have been using the arcpy.management.Append with preserve GlobalIds and maintain Attachments. Then I get an updated local copy of the data with attachments while preserving the GlobalIds. R_
... View more
07-31-2024
08:12 AM
|
0
|
8
|
2692
|
|
POST
|
If you set up a Domain/Choice List on your first field (I used the NAME field): Then in the edit Form, I have calculated value for the ALT_NAME field set to: $feature.NAME Then, when I add a feature and select the value from the dropdown in the NAME field: The ALT_NAME field is automatically populated with the full name: R_
... View more
07-31-2024
07:47 AM
|
2
|
8
|
3853
|
|
POST
|
You shouldn't have any conditions in an else statement, just a return. This reads: if the "if" is false, and the "else if" is false, then return: ((RC == '1') || (RC == '80' && FC <> 7 && FC <> 4 && FC <> 6 && FC <> 2 && FC <> 3)) {return "Interstate"} else is used to return a value if the if, and else if return False. Similar example here. R_
... View more
07-29-2024
11:20 AM
|
2
|
1
|
1380
|
|
POST
|
How is your list 'related'? From your question, why can't you just use your coded lists as domains/choice list? These will automatically be available as a dropdown in Field Maps app. Are you trying to get the code in one field and the full name in the next? R_
... View more
07-29-2024
08:33 AM
|
0
|
10
|
3906
|
|
POST
|
Sounds like you are running into the license timeout issue. I have similar scheduled tasks that run, and would eventually quit working. Turns out that when I log into Pro, and have the sign in automatically selected, Windows will save the log in credentials. However, if you don't log into Pro for a while (I believe it is 14 days), you will lose the saved credentials and the scripts will start to fail. Solution that is working for me is another scheduled task that, every Sunday night, opens Pro and closes it again. This keeps the stored credentials active, and I never run into the license timeout issue. Below is the code I schedule to run weekly to keep my license active: import os
import time
#Assign the location on the machine, usually here
ArcGIS_Pro_filepath = r"C:\Program Files\ArcGIS\Pro\bin\ArcGISPro.exe"
#Use os.startfile(), this will launch ArcPro
os.startfile(ArcGIS_Pro_filepath)
#Use time.sleep() to wait 30 seconds, enough time for ArcPro to open properly
time.sleep(30)
#Use os.system() to forcefully quit named process, ArcGISPro.exe
os.system("taskkill /f /im ArcGISPro.exe") In case this helps, R_
... View more
07-25-2024
02:29 PM
|
1
|
0
|
3274
|
|
POST
|
If you are trying to merge data from separate layers, I think you are looking for the Merge (or Append) GPT tool, not the Edit, Modify, Merge. Edit -> Modify -> Merge: "The Merge tool combines two or more features on the same layer into an existing feature or unions two or more features into a new feature. Features that do not touch or overlap, merge as parts of a multipart feature. This tool is available in the Modify Features pane." Data Management -> Merge Geoprocessing Tool: "Combines multiple input datasets into a single, new output dataset. This tool can combine point, line, or polygon feature classes or tables." R_
... View more
07-24-2024
07:58 AM
|
0
|
0
|
7449
|
|
POST
|
Could you use python to run the arcpy.DisableEditorTracking_management and arcpy.DisableAttributeRules_management, then fire off your nightly process, then arcpy.EnableAttributeRules_management and arcpy.management.EnableEditorTracking. This would effectively turn both off so they don't fire during the nightly process, the will re-enable them when done so that they are functioning normal again. R_
... View more
07-23-2024
04:03 PM
|
0
|
0
|
2053
|
|
POST
|
Are you saving the map after the updates, symbology, etc. but before the PDF export? R_
... View more
07-22-2024
08:25 AM
|
0
|
0
|
2563
|
|
POST
|
Not what you are asking, but you could configure the popup to have attachment(s) at the top, then open the edit form from the popup window. The popup will go away, but at least you get a look at the attachment first. R_
... View more
07-18-2024
07:18 AM
|
1
|
0
|
1409
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 05-14-2026 04:00 PM | |
| 1 | 09-14-2022 07:53 AM | |
| 1 | 09-14-2022 08:23 AM | |
| 1 | 05-21-2026 08:53 AM | |
| 1 | 05-14-2026 04:28 PM |
| Online Status |
Online
|
| Date Last Visited |
14m ago
|