社区所有版块导航
Python
python开源   Django   Python   DjangoApp   pycharm  
DATA
docker   Elasticsearch  
aigc
aigc   chatgpt  
WEB开发
linux   MongoDB   Redis   DATABASE   NGINX   其他Web框架   web工具   zookeeper   tornado   NoSql   Bootstrap   js   peewee   Git   bottle   IE   MQ   Jquery  
机器学习
机器学习算法  
Python88.com
反馈   公告   社区推广  
产品
短视频  
印度
印度  
Py学习  »  Python

ArcGIS Pro Python获得一个图层标注信息

GISAI • 9 月前 • 333 次点击  

import arcpy

aprx = arcpy.mp.ArcGISProject("CURRENT")

m = aprx.listMaps()[0]

layer = m.listLayers("T2024年省级_FeatureToPoint")[0]


for lbl in layer.listLabelClasses():

    print("==== LabelClass 属性列表 ====")

    print("\t Class Name: \t" + lbl.name)

    print("\t Expression: \t" + lbl.expression)

    print("\t SQL Query:  \t" + lbl.SQLQuery)

    lbldef=lbl.getDefinition("v3")

    print("==== Definition 属性列表 ====")

    print("\t Class Name: \t" + lbldef.name)

    print("\t Expression: \t" + lbldef.expression)

    print("\t expressionEngine:  \t" + lbldef.expressionEngine)

    textSymbol=lbldef.textSymbol.symbol

    print("==== textSymbol 属性列表 ====")

    print("\t fontFamilyName: \t" + textSymbol.fontFamilyName)

    print("\t Name: \t" + textSymbol.fontStyleName)

    print("\t height: \t" + str(textSymbol.height))

    Symbol=textSymbol.symbol.symbolLayers[0]

    print("==== Symbol 属性列表 ====")

    print(f"\t color: \t {Symbol.color}")


    print(f"\t color: \t {Symbol.color.values}")   


import arcpy

aprx = arcpy.mp.ArcGISProject("CURRENT")

m = aprx.listMaps()[0]

layer = m.listLayers("T2024年省级_FeatureToPoint")[0]


for lbl in layer.listLabelClasses():

    print("==== LabelClass 属性列表 ====")

    for attr in dir(lbl):

        print(attr)

    for attr in dir(lbl.getDefinition("v3")):

        print("==="+attr)

    for attr in dir(lbl.getDefinition("v3").textSymbol):

        print("text="+attr)

    for attr in dir(lbl.getDefinition("v3").textSymbol.symbol):

        print("textsymbol="+attr)

==== LabelClass 属性列表 ====

SQLQuery

__class__

__delattr__

__dict__

__dir__

__doc__

__eq__

__format__

__from_scripting_arc_object__

__ge__

__getattribute__

__getstate__

__gt__

__hash__

__init__

__init_subclass__

__le__

__lt__

__module__

__ne__

__new__

__reduce__

__reduce_ex__

__repr__

__setattr__

__sizeof__

__str__

__subclasshook__

__weakref__

_arc_object

expression

getDefinition

name

setDefinition

visible

===__class__

===__delattr__

===__dict__

===__dir__

===__doc__

===__eq__

===__format__

===__ge__

===__getattribute__

===__getstate__

===__gt__

===__hash__

===__init__

===__init_subclass__

===__le__

===__lt__

===__module__

===__ne__

===__new__

===__reduce__

===__reduce_ex__

===__repr__

===__setattr__

===__sizeof__

===__slotnames__

===__str__

===__subclasshook__

===__weakref__

===expression

===expressionEngine

===expressionTitle

===featuresToLabel

===iD

===maplexLabelPlacementProperties

===maximumScale

===minimumScale

===name

===priority

===standardLabelPlacementProperties

===textSymbol

===useCodedValue

===visibility

===whereClause

text=__class__

text=__delattr__

text=__dict__

text=__dir__

text=__doc__

text=__eq__

text=__format__

text=__ge__

text=__getattribute__

text=__getstate__

text=__gt__

text=__hash__

text=__init__

text=__init_subclass__

text=__le__

text=__lt__

text=__module__

text=__ne__

text=__new__

text=__reduce__

text=__reduce_ex__

text=__repr__

text=__setattr__

text=__sizeof__

text=__slotnames__

text=__str__

text=__subclasshook__

text=__weakref__

text=maxDistance

text=maxScale

text=minDistance

text=minScale

text=primitiveOverrides

text=scaleDependentSizeVariation

text=stylePath

text=symbol

text=symbolName

textsymbol=__class__

textsymbol=__delattr__

textsymbol=__dict__

textsymbol=__dir__

textsymbol=__doc__

textsymbol=__eq__

textsymbol=__format__

textsymbol=__ge__

textsymbol=__getattribute__

textsymbol=__getstate__

textsymbol=__gt__

textsymbol=__hash__

textsymbol=__init__

textsymbol=__init_subclass__

textsymbol=__le__

textsymbol=__lt__

textsymbol=__module__

textsymbol=__ne__

textsymbol=__new__

textsymbol=__reduce__

textsymbol=__reduce_ex__

textsymbol=__repr__

textsymbol=__setattr__

textsymbol=__sizeof__

textsymbol=__slotnames__

textsymbol=__str__

textsymbol=__subclasshook__

textsymbol=__weakref__

textsymbol=angle

textsymbol=angleX

textsymbol=angleY

textsymbol=billboardMode3D

textsymbol=blockProgression

textsymbol=callout

textsymbol=compatibilityMode

textsymbol=countryISO

textsymbol=depth3D

textsymbol=drawGlyphsAsGeometry

textsymbol=drawSoftHyphen

textsymbol=extrapolateBaselines

textsymbol=flipAngle

textsymbol=fontEffects

textsymbol=fontEncoding

textsymbol=fontFamilyName

textsymbol=fontStyleName

textsymbol=fontType

textsymbol=fontVariationSettings

textsymbol=glyphRotation

textsymbol=haloSize

textsymbol=haloSymbol

textsymbol=height

textsymbol=hinting

textsymbol=horizontalAlignment

textsymbol=indentAfter

textsymbol=indentBefore

textsymbol=indentFirstLine

textsymbol=kerning

textsymbol=languageISO

textsymbol=letterSpacing

textsymbol=letterWidth

textsymbol=ligatures

textsymbol=lineGap

textsymbol=lineGapType

textsymbol=offsetX

textsymbol=offsetY

textsymbol=offsetZ

textsymbol=overprint

textsymbol=shadowColor

textsymbol=shadowOffsetX

textsymbol=shadowOffsetY

textsymbol=smallCaps

textsymbol=strikethrough

textsymbol=symbol

textsymbol=symbol3DProperties

textsymbol=textCase

textsymbol=textDirection

textsymbol=underline

textsymbol=verticalAlignment

textsymbol=verticalGlyphOrientation

textsymbol=wordSpacing




Python社区是高质量的Python/Django开发社区
本文地址:http://www.python88.com/topic/189183