POST
|
Hi, I found success using the post below. https://community.esri.com/t5/arcgis-pro-questions/attribute-rule-to-pass-a-value-from-parent-to/td-p/1123857
... View more
03-22-2023
02:13 PM
|
0
|
1
|
323
|
POST
|
Sorry, I am using ArcMap 10.3.1. I have used a double concatenation string in python to catch 99.9% of my lookups, first using two fields against the lookup (for a general lookup), and then a 3 field lookup for specific lookups in the table. In the lookup table I have a full look up reference (Utility-Type-Material-Diameter --> Water-Pressure Main-PVC-100) but I also have partial references (Water-Pressure Main-PVC-), so using a python dictionary to input a unit rate I only use the Type and Material, then I use Type, Material, and Diameter. After the rates are in I multiply against the length. Its not a perfect system but it allows for any diameters not found in the lookup table per type and material to be given a rate. The attached text file using python
... View more
03-22-2017
02:40 PM
|
0
|
1
|
625
|
BLOG
|
Thanks for catching that Richard, I am amazed at how fast the python code works.
... View more
03-22-2017
02:32 PM
|
0
|
0
|
19113
|
BLOG
|
I am having trouble using the example for "Creating a Multi-Field Python Dictionary Key to Replace a Concatenated Join Field:" I have replaced with source/update feature classes and field but when I try to run the script I get the error message: Parsing error SyntaxError: invalid syntax (line 23) This is line if keyValue in valueDict: I am unable to discern what the problem is with the line of code. from time import strftime print "Start script: " + strftime("%Y-%m-%d %H:%M:%S") import arcpy sourceFC = r"C:\Users\user\Desktop\test.gdb\Repl_Cost" sourceFieldsList = ["WPP_TYPE", "MATERIAL", "DIAMETER", "Unit_Rate"] # Use list comprehension to build a dictionary from a da SearchCursor where the key values are based on 3 separate feilds valueDict = {str(r[0]) + "," + str(r[1]) + "," + str(r[2]):(r[3:]) for r in arcpy.da.SearchCursor(sourceFC, sourceFieldsList)} updateFC = r"C:\Users\user\Desktop\test.gdb\WPP" updateFieldsList = ["Asset_Type", "EXTG_Material", "Diameter", "Repl_Cost"] with arcpy.da.UpdateCursor(updateFC, updateFieldsList) as updateRows: for updateRow in updateRows: # store the Join value by combining 3 field values of the row being updated in a keyValue variable keyValue = updateRow[0]+ "," + str(updateRow[1]) + "," + str(updateRow[2] # verify that the keyValue is in the Dictionary if keyValue in valueDict: # transfer the value stored under the keyValue from the dictionary to the updated field. updateRow[3] = valueDict[keyValue][0] updateRows.updateRow(updateRow) del valueDict print "Finished script: " +strftime("%Y-%m-%d %H:%M:%S")
... View more
03-21-2017
04:20 PM
|
0
|
0
|
19113
|
POST
|
Hi, I have adapted a python dictionary from here to join and calculate a field between a feature class and a lookup table while concatenating on the fly. Is it possible to ignore a field while concatenating and still calculate a value in? ie. I am concatenating on the fly using a python dictionary using field [Main_Type], [Material], and [Diameter] in my feature class. In my lookup table that becomes a python dictionary I have the same fields but for each Main_Type and Diameter I leave a blank Diameter field with a lookup cost. I want to concatenate/field calculate the cost from the lookup to the feature class and if the Diameter field does not match, then match based on the Main_Type and Material only. Any help would be appreciated!
... View more
03-21-2017
04:09 PM
|
0
|
3
|
992
|
POST
|
Hi, Is there any possible way to do a "rough" join between a featureclass and a table? Similar to a lookup table in excel, I need to be able to have model builder approximate a unit rate if part of a feature code (ie. Water-Pressure Main-PVC-125 does not exist by Water-Pressure Main-PVC-150:$400 does) does not have a unit rate associated with the code. Ideally I would have unit rates for every code, but need a way to catch ones that I do not have. Thanks!
... View more
03-16-2017
02:16 PM
|
0
|
0
|
885
|
POST
|
I was able to get this to work on local data, but pointing the fc to the specific feature class in the versioned ArcSDE environment was proving troublesome. So I went with the solution I detailed above. Thanks though
... View more
07-22-2016
08:47 AM
|
0
|
0
|
736
|
POST
|
I looked at that before realizing that by using a python script to run the model itself would reduce the coding headache significantly. The python script to run the model can be found here http://joelmccune.com/run-models-as-scheduled-tasks/ When making the model, add the data directly from the source (ie. NCGIS.GIS.UtilityMain instead of from the table of Contents-Utility Main).
... View more
07-21-2016
03:48 PM
|
0
|
0
|
736
|
POST
|
Hi, I am wanting to (from Windows 10 desktop) to run a python script that exports the table from feature classes, within a feature dataset, in an ArcSDE environment. I can manually run the script in ArcMap everyday, but this will add to the tasks that I already have. I need the script to run outside of ArcGIS so I can automatically run the script with Scheduled Tasks in Windows. I have created the connection file and can list feature datasets and classes but I cannot figure out how to use the arcpy "table to excel" tool on the feature datasets within feature classes. What I have so far: # Import arcpy module import arcpy from arcpy import env import os arcpy.env.workspace = "G:\Location_of_Connection.sde_file" Utility_Pipe = "Utility_pipe_???_Unsure how to point directly at the FC in SDE" Utility_xls = "Location of Utility Excel\Utility.xls" # Process: Table To Excel arcpy.TableToExcel_conversion(Utility_Pipe, Utility_xls, "NAME", "CODE") print "done" I using ArcMap 10.3.1 in an enterprise geodatabase on windows 10. Thanks!
... View more
07-21-2016
02:56 PM
|
0
|
4
|
1885
|
Online Status |
Offline
|
Date Last Visited |
07-19-2023
12:29 PM
|