|
POST
|
How do I update a Raster Field using a cursor? I'm attempting to write a script that uses a cursor to update this field with rasters from a directory. It's a stand-alone script using arcpy for ArcGIS Pro 2.3.1. arcpy.da.InsertCursor, arcpy.da.SearchCursor and arcpy.da.UpdateCursor state that as a field_name, "Raster fields are not supported."
... View more
03-25-2019
01:17 PM
|
0
|
7
|
4087
|
|
POST
|
I couldn't get the os.walk portion of the code you provided to get to the jpgs. If I ran that portion of the script to test it (left out the cursor portion) it would iterate a folder in that same directory that had a jpg, but then stop there. It didn't find any other jpgs. So I changed those lines to this: ws = r'C:\path\to\jpegs\root'
jpgs = {} # empty dictionary
for dirName, subdirList, fileList in os.walk(ws):
for fname in fileList:
jpgs[fname[:-4]] = os.path.join(dirName,fname) Anyway, thanks to all of your help this does what I want: import arcpy, os
ws = r'C:\path\to\jpegs\root'
jpgs = {} # empty dictionary
for dirName, subdirList, fileList in os.walk(ws):
for fname in fileList:
jpgs[fname[:-4]] = os.path.join(dirName,fname)
fc = r'pathto\Projects\DOT_SignInventory\Data.gdb\WCDOT_Signs'
fields = ['OID@', 'Post_Number', 'Photo']
with arcpy.da.UpdateCursor(fc, fields) as cursor:
for row in cursor:
try:
row[2] = jpgs[row[1]]
cursor.updateRow(row)
except KeyError:
print("No photo for: {}".format(row[1]))
del cursor
... View more
03-21-2019
01:52 PM
|
1
|
0
|
700
|
|
POST
|
Randy, Thanks for that. To answer your assumptions, yes, the 'Post_Number' field is text and the 'Photo' field length is 150--so, plenty long. If I try your code word for word it runs with no error, but in the 'Photo' field it doesn't give the path. Here's an example of what it puts there: Thumbs.db\0110030.jpg Not sure why it does this? There's no 'Thumbs' file in the directory.
... View more
03-21-2019
10:10 AM
|
0
|
2
|
3385
|
|
POST
|
Curtis, Thanks, that almost got me there. But, for the jpg_dir variable, however this string looks is how it's updated in the table. For example, if it's like this in the variable: jpg_dir = r'P:\GIS_Highway_Dept\Applications\Sign Inventory\Photos\CH01' then it's updated like this in the table: P:\GIS_Highway_Dept\Applications\Sign Inventory\Photos\CH01\2410765.jpg The problem is 2410765.jpg is County Highway 24, as the first two digits in the ID is the highway number. So, that jpg isn't linked correctly, and neither will any be unless they begin with 01 (in the CH01 folder). Do I have to iterate the Photos directory first and create a list or library, as Randy pointed out?
... View more
03-20-2019
07:53 AM
|
0
|
1
|
3385
|
|
POST
|
Randy, That's correct. The first two digits of the 7 digit unique ID are based on the highway number and it's respective directory. For example: P:\GIS_Highway_Dept\Applications\Sign Inventory\Photos\CH01\0110930.jpg P:\GIS_Highway_Dept\Applications\Sign Inventory\Photos\CH19\1910930.jpg P:\GIS_Highway_Dept\Applications\Sign Inventory\Photos\CH84\8410930.jpg Etc... A dictionary is something I have to get to know how to utilize better. So, thanks, that gives me something to chew on.
... View more
03-19-2019
12:24 PM
|
0
|
4
|
3385
|
|
POST
|
Mitch, Thanks for the reply. There are multiple folders, actually. The folders have JPGs of signs of a certain highway. And there are as many folders containing these JPGs as there are county highways (CH01, for example). EDIT: I tried the code you provided on a copy, but it didn't seem to get updated. I put a print statement in after updateRow() and the directory is actually being called because it printed out all the JPGs. cursor.updateRow(row)
print(path_to_jpg)
... View more
03-19-2019
09:11 AM
|
0
|
3
|
3385
|
|
POST
|
I've been tasked with updating attribute table fields with file paths to image files in a folder based on a unique ID. I'm having trouble thinking up a script that will do this? I'm working on a standalone script in ArcGIS Pro 2.3.1 Arcpy. This is an example of how the table should look. Every JPG has a unique ID that matches the Post_Number field unique ID. Currently, the paths to the JPGs are entered manually into the table, and there are 1000s of them. All I've done so far is create a cursor that searches the Post_Number and Photo fields. import arcpy, os
fc = r'pathto\Projects\DOT_SignInventory\Data.gdb\WCDOT_Signs'
fields = ['Post_Number', 'Photo']
with arcpy.da.SearchCursor(fc, fields) as cursor:
for row in cursor:
print(u"{0}, {1}".format(row[0], row[1]))
... View more
03-19-2019
08:10 AM
|
0
|
11
|
4337
|
|
POST
|
Aaron, What comes to mind is something with the graphics. When you share/export the layout is your resolution set too low? I keep mine at 300 dpi.
... View more
03-11-2019
12:38 PM
|
0
|
0
|
3484
|
|
POST
|
Dan, Running the tool failed: Curtis, Thanks, silly mistake. Using the string literal, however, it produced another error. arcpy.UpgradeDataset_management(r'\\gisfile\GISstaff\Jared\WillCoGIS_DataSHP_Pro.gdb\Street_Anno') Traceback (most recent call last):
File "<string>", line 1, in <module>
File "c:\program files\arcgis\pro\Resources\arcpy\arcpy\management.py", line 6117, in UpgradeDataset
raise e
File "c:\program files\arcgis\pro\Resources\arcpy\arcpy\management.py", line 6114, in UpgradeDataset
retval = convertArcObjectToPythonObject(gp.UpgradeDataset_management(*gp_fixargs((in_dataset,), True)))
File "c:\program files\arcgis\pro\Resources\arcpy\arcpy\geoprocessing\_base.py", line 498, in <lambda>
return lambda *args: val(*gp_fixargs(args, True))
arcgisscripting.ExecuteError: Failed to execute. Parameters are not valid.
ERROR 001267: Dataset type does not support upgrade.
Failed to execute (UpgradeDataset). Upgrade Dataset—Data Management toolbox | ArcGIS Desktop According to the Tool Reference page, the GDB in which the feature dataset resides must be updated before the dataset is updated. So, I ran the arcpy.UpgradeGDB_management() function. The resulting error said "the geodatabase is already at the current release". It seems I've come full circle. default_gdb = r"\\gisfile\GISstaff\Jared\WillCoGIS_DataSHP_Pro.gdb"
arcpy.UpgradeGDB_management(default_gdb, "PREREQUISITE_CHECK", "UPGRADE") Traceback (most recent call last):
File "<string>", line 1, in <module>
File "c:\program files\arcgis\pro\Resources\arcpy\arcpy\management.py", line 6152, in UpgradeGDB
raise e
File "c:\program files\arcgis\pro\Resources\arcpy\arcpy\management.py", line 6149, in UpgradeGDB
retval = convertArcObjectToPythonObject(gp.UpgradeGDB_management(*gp_fixargs((input_workspace, input_prerequisite_check, input_upgradegdb_check), True)))
File "c:\program files\arcgis\pro\Resources\arcpy\arcpy\geoprocessing\_base.py", line 498, in <lambda>
return lambda *args: val(*gp_fixargs(args, True))
arcgisscripting.ExecuteError: Failed to execute. Parameters are not valid.
ERROR 001046: The geodatabase is already at the current release and cannot be upgraded.
... View more
03-01-2019
06:49 AM
|
0
|
0
|
2421
|
|
POST
|
No, the environment is not set elsewhere. There's only that one line. I also tried using the full path to the Dataset inside the FGDB, but it also threw an error. I'm working in the console, by the way. import arcpy
arcpy.UpgradeDataset_management('\\gisfile\GISstaff\Jared\WillCoGIS_DataSHP_Pro.gdb\Street_Anno') Error: Traceback (most recent call last):
File "<string>", line 1, in <module>
File "c:\program files\arcgis\pro\Resources\arcpy\arcpy\management.py", line 6117, in UpgradeDataset
raise e
File "c:\program files\arcgis\pro\Resources\arcpy\arcpy\management.py", line 6114, in UpgradeDataset
retval = convertArcObjectToPythonObject(gp.UpgradeDataset_management(*gp_fixargs((in_dataset,), True)))
File "c:\program files\arcgis\pro\Resources\arcpy\arcpy\geoprocessing\_base.py", line 498, in <lambda>
return lambda *args: val(*gp_fixargs(args, True))
arcgisscripting.ExecuteError: Failed to execute. Parameters are not valid.
ERROR 000110: \gisfile\GISstaff\Jared\WillCoGIS_DataSHP_Pro.gdb\Street_Anno does not exist
Failed to execute (UpgradeDataset).
... View more
02-28-2019
02:26 PM
|
0
|
2
|
2421
|
|
POST
|
arcpy.UpgradeDataset_management('Street_Anno_E') Traceback (most recent call last):
File "<string>", line 1, in <module>
File "c:\program files\arcgis\pro\Resources\arcpy\arcpy\management.py", line 6117, in UpgradeDataset
raise e
File "c:\program files\arcgis\pro\Resources\arcpy\arcpy\management.py", line 6114, in UpgradeDataset
retval = convertArcObjectToPythonObject(gp.UpgradeDataset_management(*gp_fixargs((in_dataset,), True)))
File "c:\program files\arcgis\pro\Resources\arcpy\arcpy\geoprocessing\_base.py", line 498, in <lambda>
return lambda *args: val(*gp_fixargs(args, True))
arcgisscripting.ExecuteError: ERROR 999999: Something unexpected caused the tool to fail. Contact Esri Technical Support (http://esriurl.com/support) to Report a Bug, and refer to the error help for potential solutions or workarounds.
Failed to execute (UpgradeDataset). I can't edit the annotation on an ArcGIS Pro 2.3.1 project. It's an imported MXD with an annotation feature class. Using arcpy I attempted to upgrade the anno, but got an error. I haven't contacted ESRI Support yet because I wanted to see if anyone knows about this. There was a similar question regarding upgrading asked, but it was using the tool: https://community.esri.com/message/799004-re-how-do-i-upgrade-annotation-for-use-in-pro?commentID=799004#comment-799004
... View more
02-28-2019
01:15 PM
|
0
|
5
|
2628
|
|
POST
|
Robert, Thanks, I marked your latest reply as correct. I added the route url as you pointed out. It was still throwing the same error in the Chrome console. On top of that, I had to add two more <serverUrl> tags in the config file to get it to work. One was for my organisation's AGOL account and the other was to ArcGIS REST services url. I had to create a new app at ArcGIS for Developers so that I could obtain a ClientID and ClientSecret. See code from config file below. <?xml version="1.0" encoding="utf-8" ?>
<ProxyConfig allowedReferers="*"
mustMatch="true">
<serverUrls>
<serverUrl url="https://willcountygis.maps.arcgis.com" username="blabla" password="blabla" rateLimit="600" rateLimitPeriod="60"
matchAll="true"/>
<serverUrl url="https://route.arcgis.com/" username="blabla" password="blabla" rateLimit="600" rateLimitPeriod="60"
matchAll="true"/>
<serverUrl url="https://services.arcgis.com/" clientid="blabla" clientSecret="blabla" rateLimit="600" rateLimitPeriod="60"
matchAll="true"/>
</serverUrls>
</ProxyConfig>
... View more
02-27-2019
11:14 AM
|
0
|
0
|
1948
|
|
POST
|
<?xml version="1.0" encoding="utf-8" ?>
<ProxyConfig allowedReferers="*"
mustMatch="true">
<serverUrls>
<serverUrl url="http://services.arcgisonline.com"
matchAll="true"/>
</serverUrls>
</ProxyConfig> Robert, Here's the content of the config file. How would I do that?
... View more
02-26-2019
02:28 PM
|
0
|
3
|
1948
|
|
POST
|
I want to use the Directions widget in a custom app. I'm using 4.9. To avoid the prompt to sign in I'm setting up the proxy. -Tested the DotNet proxy. It works. -Put in the relevant code as such: require(["esri/core/urlUtils"], function(urlUtils) {
urlUtils.addProxyRule({
urlPrefix: "route.arcgis.com",
proxyUrl: "https://webapp.willcountyillinois.com/DotNet/proxy.ashx"
});
}); Got the following error on Chrome console. The widget isn't working. Not sure why.
... View more
02-26-2019
02:18 PM
|
0
|
5
|
2045
|
|
POST
|
You can Clip Layers in ArcPro just like in ArcMap. But I think it's even enhanced as I don't remember a dropdown that can exclude layers from being clipped-- pretty nice. All you do is left click the map frame on the Layout tab --> Properties --> Clip Layers
... View more
02-21-2019
08:37 AM
|
2
|
9
|
3484
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 06-25-2026 12:25 PM | |
| 1 | 05-04-2026 08:45 AM | |
| 1 | 04-20-2026 01:20 PM | |
| 1 | 07-24-2025 01:27 PM | |
| 1 | 11-13-2025 08:22 AM |
| Online Status |
Offline
|
| Date Last Visited |
Thursday
|