|
POST
|
What you (and lots of others) were probably struggling with is you need to construct a valid python expression inside a python string, not as an actual python expression. For example, say you wanted to calculate a string field to be something like r"A:\B\D.d", if you passed that to arcpy.CalculateField_management, the tool would only see A:\B\D.d which is not valid python (it's not quoted) and the backslashes wouldn't be escaped. You would construct your expression as r'r"A:\B\D.d"'. There's a few ways to make this easier to get your head around with string formatting. In simple terms, think about what you need to have valid python syntax, then wrap all that in quotes to make a string.
... View more
07-06-2018
07:20 PM
|
0
|
0
|
4723
|
|
POST
|
Try arcpy.CalculateField_management(fc, 'Source', 'r"' + fc + '"' , "PYTHON")
... View more
07-06-2018
05:42 PM
|
0
|
2
|
4723
|
|
POST
|
Did you ever figure this out? The answer is to quote the strings in the expression. If you're having trouble, put some more detail (i.e some code would be good) in about your input values and how you construct the expression. Also, don't parse paths with .split("\")... Use os.path.split(your_file_path) which will handle all the slash permutations for you.
... View more
07-05-2018
05:54 PM
|
1
|
4
|
4723
|
|
POST
|
You should be able to use `execfile('path/to/script.py')` to run your script from the python window in ArcMap.
... View more
06-24-2018
04:39 AM
|
0
|
0
|
5705
|
|
POST
|
Perhaps run your test suite in the arcgispro-py3 conda env (eg using proenv.bat) and call python directly rather than calling propy.bat.
... View more
04-21-2018
02:02 AM
|
1
|
0
|
1617
|
|
POST
|
String formatting is good but I always forget the more complex format codes and have to look it up and experiment every time. Might be simpler to use the zfill function: str(!SeqNo!).zfill(3) "{}{}-{}".format(!NRS!, !NSA!, str(!SeqNo!).zfill(3)) https://docs.python.org/2/library/string.html
... View more
03-30-2018
04:17 AM
|
1
|
0
|
5168
|
|
POST
|
Creating the tbx can only be done via the ArcGIS GUI. It is a binary format. Adding python scripts to the tbx can also only be done via the ArcGIS GUI.
... View more
03-30-2018
04:10 AM
|
2
|
1
|
5841
|
|
BLOG
|
Nice. Gets a bit trickier when dealing large rasters 😉 What's your preferred method of handling NoData? I usually upcast to float and use np.nan<statistic>, I've tried masked arrays but found them quite slow.
... View more
02-09-2018
01:38 AM
|
0
|
0
|
1661
|
|
POST
|
I understood from Kevin Hibma's comment that the runtime was there for running GP services and the documentation seems to show you can publish GP tools from ArcGIS Pro - What is a web tool?—ArcGIS Pro | ArcGIS Desktop
... View more
02-08-2018
01:03 PM
|
0
|
1
|
1581
|
|
POST
|
Suggest you look at GPStringHidden instead. The GPEncryptedString is only for Esri tools that can decrypt the string, such as the database connection tools.
... View more
02-08-2018
02:36 AM
|
1
|
0
|
1553
|
|
POST
|
Have you tried? There's a Python 3 runtime available in Server 10.5 on Linux. A comment on GIS StackExchange seems to indicate the Python 3 runtime might be available for Windows as well. Server 10.5 does have an internal version of Python3. This is how it can support geoprocessing services (web tools) created from ArcGIS Pro. I dont have a copy of Server 10.5 in front of me to drill down, but its somewhere deep deep down, like C:\Program Files\Server\Framework\ ... down down \ ..similar path to Python you see in Pro – KHibma Jan 15 at 18:04
... View more
02-08-2018
02:00 AM
|
1
|
3
|
1581
|
|
POST
|
Why convert to individual tiffs first? It doesn't matter that the ECWs are read only, the question isn't about outputting to ECW.
... View more
01-26-2018
03:12 AM
|
0
|
1
|
7228
|
|
POST
|
Use the mosaic to new raster tool to output a single tiff file: Mosaic To New Raster—Help | ArcGIS for Desktop Make sure you set a compression type in the environment settings or your output file size will be much larger than the sum of the originals.
... View more
01-26-2018
03:07 AM
|
2
|
0
|
7229
|
|
POST
|
The simplest way to activate your ArcGIS Pro conda environment is to start the ArcGIS Pro Python Command Prompt. You can then just type python path\to\your\script.py to run your script. Start Menu > ArcGIS > ArcGIS Pro > Pytthon Command Prompt
... View more
10-31-2017
03:08 PM
|
2
|
0
|
3637
|
|
POST
|
Kate, you don't specify which python to use *in* your script. You specify which python to use when you *run* your script. i.e by activating the arcgispro-py3 environment and calling python path\to\your\script.py or directly by calling propy.bat path\to\your\script.py
... View more
10-30-2017
01:58 PM
|
2
|
0
|
3637
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 07-24-2022 03:08 PM | |
| 1 | 07-30-2025 03:00 PM | |
| 1 | 06-10-2025 08:06 PM | |
| 5 | 05-20-2025 07:56 PM | |
| 1 | 05-04-2025 10:34 PM |