
#coding=utf-8
import xlrd
import arcpy
wb=xlrd.open_workbook(ur'e:\test\小区面_TableToExcel.xls')
sheet1 = wb.sheets()[0]
nrows = sheet1.nrows
ncols = sheet1.ncols
name=''
value=0.0
courts={}
for i in range(nrows):
if i==0:
continue
name=sheet1.cell(i,0).value
value=sheet1.cell(i,1).value
if not courts.has_key(name):
courts[name]=value
arcpy.env.workspace=r'E:\test\Data80.gdb'
fes = arcpy.ListFeatureClasses(feature_dataset='RG')
for fc in fes:
if fc==ur'小区面':
with arcpy.da.UpdateCursor(fc,["Name","P3"]) as cursor:
for row in cursor:
courtname = row[0]
if courts.has_key(courtname):
row[1] = courts[courtname]
cursor.updateRow(row)
print courtname
del cursor
print 'over'
#coding=utf-8
import arcpy
mxd = arcpy.mapping.MapDocument(r"e:\test\p3.mxd")
for lyr in arcpy.mapping.ListLayers(mxd):
print lyr.symbologyType
if lyr.symbologyType == "GRADUATED_COLORS":
lyr.symbology.valueField = "Shape_Area"
lyr.symbology.numClasses = 20
print lyr.symbology.classBreakLabels
mxd.save()
del mxd
print 'over'
