|
POST
|
I know this post isn't "fresh", but I wanted to thank you for that first line of code in the solution. Fantastic! I knew I had used an attribute of $feature in a filter before, but I couldn't remember the syntax and finding it online is close to impossible...maybe I'm Google search challenged. Finally, I tripped over it here (probably where I stole it from the first time I did it). Man, could Esri have come up with a more convoluted syntax?... Tildes, single quotes, 2 dollar signs, and every kind of bracket....Yikes. Thank you for figuring this out for all of us.
... View more
01-17-2023
12:58 PM
|
0
|
0
|
2380
|
|
POST
|
The syntax you are debugging is specific to using field calculator in Pro or ArcMap when updating a table's field (using the Python Expression Type). You could try entering it there and testing it (I.E. the expression in the top box and the code block below like this) I debugged it using Python in Spyder like this (since python doesn't understand the syntax "CodeBlock" as far as I know, and the code block itself is just a python function.): # -*- coding: utf-8 -*-
"""
Created on Mon Jan 9 11:17:59 2023
@author: Tester
"""
lengthField = 10
widthField = 5
num = 2
expression = "reclass(!%d!,!%d!,!%d!)" % (lengthField, widthField, num)
def reclass(lengthField,widthField,num):
if ((lengthField/num) >= (widthField)):
return 'True'
else:
return ''
print (expression)
print (reclass(lengthField,widthField,num)) The result was I hope I understood you question correctly and that this is helpful. K
... View more
01-09-2023
08:52 AM
|
0
|
1
|
2708
|
|
POST
|
Something like this maybe. Its an old(er) school way (Sorry, I haven't tested it). expression = "reclass(!%d!,!%d!,!%d!)" % (lengthField, widthField, num)
... View more
01-05-2023
10:52 AM
|
1
|
2
|
2318
|
|
POST
|
I have a map service that fails to initialize when its set to use a dedicated instance pool (min 1, max 3) and starts no problem when switched to using the shared instance pool. Any ideas why this would be the case would be appreciated.
... View more
12-20-2022
08:31 AM
|
0
|
3
|
1104
|
|
POST
|
I would appreciate some help understanding "Version" lock types on a branch versioned geodatabases. The table below shows the table returned when I go to my database connection (sde schema owner) and click "Administration" and then select "Locks" (user names and service names have been changed of course). The table is sorted from Oldest to Most Recent "Time Acquired" I get that the edits I made this afternoon, and that I have not saved, would lock the version I made them in (Yellow below) . What I DO NOT GET is: 1) Why are some other named versions (they appear as random project numbers under "Object Name" below) holding locks? Is it because they have unsaved edits? Some other reason? 2) Why so many old locks on "DEFAULT"? What could be causing this? Are they a problem/potential problem? Could a web service have created them? 3) What does the "Expiration Time" mean on the lock? Does that mean that these older locks have expired and are not locking the database at all? What happens when a lock expires? Sorry for so many questions. But it seems important and I can't find a lot online that explains it. K
... View more
10-17-2022
03:38 PM
|
2
|
2
|
2254
|
|
POST
|
Yes. If you include an iterator in any part of your model it will run all of the tools/processes in the model every time through the iterator. The solution to this is breaking the one model into multiple submodels and calling the submodels that contains the iterator from the "Main" model. Look for "Advanced use of model iterators" here: Add a submodel to a model—ArcGIS Pro | Documentation
... View more
08-05-2022
11:38 AM
|
0
|
0
|
1543
|
|
POST
|
Hi everyone, We have hundreds of layers (mostly feature classes) spread across several enterprise GDBs (SQL Server). We did not create most of this data, but rather we acquired it from other sources (Federal, State, County, City governments). We regularly maintain these sources by getting updates and replacing the existing with the most recent data we have acquired. Recently we have started to think about how we can report on these data sets to managers and non-GIS folks. These users want to see an "Excel like" report containing one line per data layer containing data such as "FileName", "AcquiredBy", "AcquiredFrom", "AcquiredDate", "CurrentToDate", "Description", "CostOfAcquisition", etc. My first thought is that we can mine as much of this data as we can from any metadata that might have accompanied the layers when we acquired the data. My problem is I don't even know where to start with such an effort. There is probably a metadata object I can access using Python, but how would I go about doing this. Any help or guidance would be greatly appreciated. K
... View more
08-03-2022
12:55 PM
|
1
|
5
|
1617
|
|
POST
|
I cracked the case... I'm nothing if not persistent. After writing try/except conditions and examining the description of my workspace (established using a connection file) I determined that Arcpy was indeed loading correctly and that the problem was Arcpy was not establishing a connection to my database using my connection file when my script was run from the scheduler. So, just on a lark, I moved the "connectionfilename.sde" from its current location on a network drive to a location on the C: drive (the same folder the "scriptname.py" file was in).... and Voila it worked. That was at least a day out of my life. Just for the record I tried: Alternating "Run only when user is logged in" and "Run whether user is logged in or not" Alternating "Run with highest privileges" Running Task Scheduler as "Admin" Running the python script from a batch file Running "path/python.exe" as the "Program/script" with "python path/file" as the argument Running "cmd" as the program and the batch file as the argument Alternating the "Start in" path.... All for naught I should have thought about the easy solution first, but your keys are always in the last place you look.
... View more
06-02-2022
08:08 AM
|
1
|
3
|
9839
|
|
POST
|
I added the code to describe the workspace and another line to show the path to the python .exe being used when the program is run (on the theory that maybe Scheduler was using a different python.exe than the one intended). The results are below. The path to the python.exe returned by the script is the same whether it is run from the command line or the scheduler C:\Users\GarbadeK\AppData\Local\ESRI\conda\envs\arcgispro-py3-clone1\python.exe So that doesn't seem to be the problem. But the describe of the workspace shows data when run from the command line and shows nothing when run from scheduler. So I think the issue is ArcPy is not being import... even though import ArcPy is the first statement in the script (after # -*- coding: utf-8 -*-). I wonder if its because one of the folders in the python.exe path is hidden?.... I'm just grasping at straws at this point. I've run Task Scheduler as Admin, run it both as has to be logged in and as not logged in, I have "Use highest permissions" checked.... So close, but yet so far. K
... View more
06-01-2022
11:00 AM
|
0
|
4
|
2464
|
|
POST
|
It runs the script but same result - ListFeatureClasses is still empty.... It must have something to do with ArcPy running in scheduler and the complete lack of error messaging in scheduler (that I know of)... maybe its erroring out setting the workspace I don't even know it.
... View more
06-01-2022
06:33 AM
|
0
|
6
|
7418
|
|
POST
|
I don't have a connection to the office right now, but i will share in the morning (EST). Basically the bat file contains the exe call followed by the bat file name argument as shown above with an ECHO OFF before that line and PAUSE after it, but I really like your idea to call cmd and pass the bat as an argument. I can run the bat from the cmd manually and it works fine. I'll give it a go tomorrow morning and keep you posted.
... View more
05-31-2022
04:37 PM
|
0
|
0
|
7427
|
|
POST
|
Sorry. I should have mentioned that that was the first way I tried configuring it.... it doesn't seem to have a problem with "import arcpy" or setting the workspace.... just getting the FC list.
... View more
05-31-2022
10:13 AM
|
0
|
0
|
7444
|
|
POST
|
DB Authentication connecting as Data Owner. I'm running the task in the Scheduler using my Domain login on my desktop.
... View more
05-31-2022
09:01 AM
|
0
|
0
|
7464
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 07-25-2025 07:54 AM | |
| 1 | 07-25-2025 10:45 AM | |
| 1 | 05-10-2022 11:06 AM | |
| 1 | 05-09-2022 04:05 AM | |
| 1 | 03-17-2022 04:04 AM |
| Online Status |
Offline
|
| Date Last Visited |
07-25-2025
07:47 AM
|