arcpy更新属性并获取自然间断法分级渲染labels

时间:2020-11-18 14:47:05   收藏:0   阅读:40

技术分享图片

 

 

技术分享图片
#coding=utf-8
import xlrd
import arcpy


wb=xlrd.open_workbook(ure:\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=rE:\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
View Code
#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

技术分享图片

 

原文:https://www.cnblogs.com/yansc/p/13999281.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!