|
POST
|
Are you running inside of Pro/Map? When in ArcMap or Pro, picking data listed in the TOC is already a feature layer/view. (converted in the background when loaded into the Map) Select Layer by Attributes takes a layer or table view, not a feature class or table directly: The input must be a feature layer or a table view. The input cannot be a feature class or table If you are trying to run it standalone, you will need to the Make Feature Layer or Make Table View first (using full path to the data), then pass that "layer" to the Select by Attributes. R_
... View more
07-13-2023
09:07 AM
|
0
|
1
|
2229
|
|
POST
|
Also, I see the python function, but don't see you calling it: You need to call update() and pass the variables to it. R_
... View more
07-13-2023
07:04 AM
|
0
|
0
|
2254
|
|
POST
|
It's been a while since I've done something like this, and was back when it was still the arcpy.mapping before Pro. However, when I had to do similar, I had a list of the projects (I used search cursor and set() to get the unique list), I would loop through the list and set a definition query on the layer so that it only shows data for the appropriate project. Then, set the extent to the getSelectedExtent of the layer (which sets the extent to the queried features) (buffer/pad as needed), then export to PDF. the next loop will change the definition query on the layer to the next project, change to the extent of the features in the layer, export, etc. I know there has been a lot of changes to the mapping/mp module, but should still be similar functionality to do something similar. R_
... View more
07-12-2023
08:43 AM
|
0
|
0
|
4008
|
|
POST
|
I mean something like this: projectList = ['Project1', 'Project2', 'Project3']
for proj in projectList:
expression = f'"ProjectField" = "{proj}"'
with arcpy.da.SearchCursor(fc, [name_field, wbs_field, district_field, length_field],expression) as cursor: #only grab rows that match the expression in cursor
for row in cursor:
# Do your stuff here
That runs the search cursor on it and only grabs the data that matches the project name, then runs search cursor on it again (next loop) with the next project name, etc. Using the 'with' as 'cursor' will also release the cursor object so it can be re-established with the new expression. Also, the fewer fields you add to the cursor, the faster it will run. Don't see anywhere you need the geometry of each feature, so no need for SHAPE@. Though, not sure why you are loading a bunch of rows of data into a cursor as I don't see where that cursor would be used later in the script. Looks like you want to change what features are displayed each iteration, not loading all the table data into a cursor. Think maybe you are wanting to loop over a list of projects, establish a definition query on the projects layer that only displays the features for that project, export the map, next project in the list, etc. R_ Also, I moved this post into Python Questions for you rather than the Python API forum so you may get more responses.
... View more
07-11-2023
12:52 PM
|
0
|
1
|
4039
|
|
POST
|
Code formatting will make it easier to follow. Not exactly sure what you are trying to do, but can't you just put a where clause on the SearchCursor so it only grabs the records you want, then re-establish the cursor for each project? R_
... View more
07-11-2023
10:44 AM
|
0
|
1
|
4084
|
|
POST
|
Not sure, but could be because AGOL requires https now, not http. I see your images server is only sending http. R_
... View more
07-07-2023
03:04 PM
|
2
|
0
|
2689
|
|
POST
|
Did you Update the offline areas, or, 'Recreate' them? You said you added fields, so, schema change: "Recreate Re-creating the offline map area differs from updating the offline map area. When you use the Recreate action, it deletes all packages associated with the map area and re-creates them based on the offline map area's settings. The primary reason to re-create a map area is to pick up schema changes that have occurred after you created the offline map area. For example, if you add or delete a field or change an attribute value list or range (domains), you must re-create the offline map area to pick up those changes." R_
... View more
07-06-2023
10:41 AM
|
3
|
1
|
3565
|
|
POST
|
Did you re-create and re-download your offline areas after altering the schema of the dataset? R_
... View more
07-06-2023
08:25 AM
|
0
|
1
|
3574
|
|
POST
|
One quick easy method: Use ArcCatalog, create new empty FGDB (or have existing FGDB to use). Load the feature class into ArcMap, select one feature. Right click on the feature class in the TOC, Data, Export Data. Set Export: to "Selected Features", navigate to the FGDB and give it a name, select OK. When prompted to add layer to display, select Yes. Edit the new feature class and delete the one feature that exported with it. You now have a FGDB copy of the schema for the dataset. OR, as @DanPatterson suggested, export schema only to xml workspace Document, then Import that xml workspace document into the desired FGDB. R_
... View more
07-06-2023
08:16 AM
|
0
|
0
|
4146
|
|
POST
|
Hmm, not able to reproduce. Perhaps something 'changed' since the offline areas were created (my offline areas 'changed' on 6/5 for attachment size and started overloading my offline sync with 'actual size' images, even though they were set to medium. had to change, save, change back to medium, save, and re-create offline areas to fix, this also affected the live mapping though). You might try syncing all your offline maps, then remove the offline area(s) from the device(s), and re-create the offline areas in Field Maps Designer (re-create seems to capture 'changes' that update doesn't). Then re-download the offline area(s) and test to see if that resolves it. Make sure everything is synced to the source data first, as once you remove offline area from the device, any edits are gone. R_
... View more
07-05-2023
08:01 AM
|
0
|
0
|
5178
|
|
POST
|
I have a script that calculates values for AGOL hosted feature layers, and come across the 504 error frequently. In fact, I pretty much expect it to fail most days if you are calculating very many records. So, I createa list of the unique id's for the features I want to update, and an empty list called doneList. Every iteration that succeeds appends the ID for that feature to the doneList. Then, I have the call to the function that does the updates in a try: within a try: and while true statement similar to : try:
CreateIDlist() # runs function to populate the list of features I want to process
while True:
try:
DotheCalcs()
break # stop the loop if the function completes sucessfully
except Exception as e:
print("Function errored out!", e)
print("Retrying ... ")
print("Done with inner try") So, the try function creates the list of ID's to process, then enters the While True: try: block. that sends it to the function that does the calculations, and if it succeeds without error, it will "break" and end the whle/try loop and we are done. If it errors, it prints the Function error out/Retrying message and sends it back to the DotheCalcs() function again. In beginning of the DotheCalcs() function, for ID in toUpdateList:
if ID not in donelist:
(fl.calculate(where=sqlclause, calc_expression={"field": "Description", "value" : DescrDict[mc]})) # Do the Calculation
donelist.append(mc) So, if it fails, it will try to run again, but, already has a list of what has been done already. If the ID is not in the list, then the calculation has not succeeded on that feature, so it tries it again. Some days it will process all 11,000 records without fail, others, it will restart itself one to many times until the list is completed. R_
... View more
06-30-2023
01:33 PM
|
2
|
0
|
1537
|
|
POST
|
Are you using the same map for offline and live field map editing? In Field Map Designer, Offline features and attachment deliver, is it set to not update feature? R_
... View more
06-30-2023
01:08 PM
|
0
|
1
|
5191
|
|
POST
|
I would start with the Find Identical GP tool and/or the Delete Identical GP tool. R_
... View more
06-28-2023
11:01 AM
|
1
|
0
|
997
|
|
POST
|
I have a stand alone table in the same database that I use for this kind of thing. var tbl = FeatureSetByName($datastore,"InputTable",['Coeff'], False);
var feat = First(tbl)
var year = $feature.ForegandeAr * Pow(feat.Coeff, 1);
return Round(year) I grab the table and the field that I have populated with the value (in this case, 'Coeff'). Grab the fist row in that layer (even though there is only one (any other needed values are their own column)). Use the value of the feat.Coeff field in the Pow() function. R_
... View more
06-28-2023
07:55 AM
|
0
|
1
|
1700
|
|
POST
|
You will want to test this on a copy as I haven't tried it since the latest "Update...". Only way I know in AGOL to modify the editing template is with Map Viewer Classic. Once loaded, choose "Edit", select the template you want to modify and choose "Manage": Then you will see a dropdown with Properties: You can Copy one of the exiting templates to a new one, then modify the new template properties as desired and "SAVE CHANGES" at the bottom. Then, exit Map Viewer Classic and do NOT save changes to the map so it doesn't kill your symbols, popups, etc. R_
... View more
06-27-2023
04:45 PM
|
3
|
4
|
6007
|
| 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 |
yesterday
|