POST
|
Thanks. Probably beyond my ability and time, but I see what I can do with this if something else doesn't come up.
... View more
02-08-2021
11:55 AM
|
0
|
1
|
854
|
POST
|
ArcGIS Dektop 10.6.1 I have to repeat a process on many GDBs quarterly. Need to calculate spatial fields (e.g. ccordinateX, coordinateY, featureArea, featureAreaUom, featureLength, featureLengthUom, featurePerimeter, featurePerimeterUom) with units based on an input CSV list of feature classes. Feature classes have spatial unit attributes that may differ based on the input CSV. CSV sample: Feature_Class Area UOM_Area Line UOM_Line Grid_A ACRES Acres MILES_US US Survey Mile Ber_L NA NA FEET_US Feet RegA_A SQUARE_YARDS Square Yards FEE_US Feet AirDot_P NA NA NA NA I merged some existing scripts (I'm still a novice with python) to get the script below, which works (except I have to build out for more fields), except it sets the featureArea and featureLength units to meters based on the coordinate system of the feature classes, rather than taking units from the CSV. There is a commented out line close to the bottom "row[count] = SHAPE.LENGTH@r[3]" that is the area where I think this needs to be altered? import arcpy, os, sys, shutil, csv
Repository = arcpy.GetParameterAsText(0)
InCSV = arcpy.GetParameterAsText(1)
arcpy.env.workspace = Repository
#Create list of feature classes
def getFCList(vPath):
vFullFCList = []
vDSList = arcpy.ListDatasets()
for ds in vDSList:
vFCList = arcpy.ListFeatureClasses('*', 'All', ds)
vFullFCList = vFullFCList + vFCList
vFCList2 = arcpy.ListFeatureClasses()
vFullFCList = vFullFCList + vFCList2
return vFullFCList
#Get list of feature classes
fcList = getFCList(arcpy.env.workspace)
#List of fields to be checked
geoFields = [ "coordinateX", "coordinateY", "featureLength", "featureLengthUom", "featureArea", "featureAreaUom", "featurePerimeter", "featurePerimeterUom"]
for fc in fcList:
fields = []
desc = arcpy.Describe(fc)
dataSet = desc.path
arcpy.AddMessage("Updating Attributes in {0}".format(fc))
fieldList = arcpy.ListFields(fc)
#If the following fields exist, adds the field name to a list to be used later.
for field in fieldList:
if field.name == "coordinateX":
fields.append(field.name)
fields.append("SHAPE@X")
elif field.name == "coordinateY":
fields.append(field.name)
fields.append("SHAPE@Y")
elif field.name == "featureLength":
fields.append(field.name)
fields.append("SHAPE@LENGTH")
elif field.name == "featureArea":
fields.append(field.name)
fields.append("SHAPE@AREA")
elif field.name == "featurePerimeter":
fields.append(field.name)
fields.append("SHAPE@LENGTH")
else:
fields.append(field.name)
#The tool checks if the field exists within a feature class
#If the field exists it will populate that field with its corresponding value
arcpy.AddMessage(fields)
with open(InCSV, 'r') as source:
rdr = csv.reader(source)
UpdateName = desc.name
for r in rdr:
if len(fields) > 0:
with arcpy.da.UpdateCursor(fc, fields) as cursor:
for row in cursor:
count = 0
while count < len(fields):
if fields[count] == "coordinateX":
idx = fields.index("SHAPE@X")
row[count] = row[idx]
elif fields[count] == "featureLength" and UpdateName == r[0]:
idx = fields.index("SHAPE@LENGTH")
row[count] = row[idx]
#row[count] = SHAPE.LENGTH@r[3]
elif fields[count] == "featureAreaUom" and UpdateName == r[0]:
row[count] = r[2]
elif fields[count] == "featureLengthUom" and UpdateName == r[0]:
row[count] = r[4]
count += 1
cursor.updateRow(row)
sys.exit()
... View more
02-08-2021
11:26 AM
|
0
|
4
|
864
|
POST
|
When I export my Data Reviewer table to Report - "Automated Check Report By Origin Table", some fields are mysteriously empty in the output. In the attached report, cells G139, G181, and G641 do not have Severity #s. When I check the Reviewer table and the batch file, I can see them there. Any ideas why data would sometimes not be exported to the report? I'm using ArcGIS Desktop 10.3.1 with Data Reviewer patch 7
... View more
01-12-2017
01:21 PM
|
0
|
0
|
449
|
Online Status |
Offline
|
Date Last Visited |
12-19-2023
08:30 AM
|