--Layer-Klasse (arcpy._mp.Layer) SHAPE @ ┐ --Polygon-Klasse (arcpy.arcobjects.geometries.Polygon) getPart () ┐ --Array-Klasse (arcpy.arcobjects.arcobjects.Array) getObject (0) ┐ --Array-Klasse (arcpy.arcobjects.arcobjects.Array) getObject (i) ┐ --Point-Klasse (arcpy.arcobjects.arcobjects.Point)
GetPolygonVertex.py
import arcpy
#Überprüfen Sie die Eingabeparameter
arcpy.AddMessage("GetArgumentCount() = {0}".format(arcpy.GetArgumentCount()))
for i in range(arcpy.GetArgumentCount()):
param = arcpy.GetParameter(i)
paramText = arcpy.GetParameterAsText(i)
arcpy.AddMessage("GetParameter({0}) = {1}".format(i, param))
arcpy.AddMessage("GetParameter({0}).__class__ = {1}".format(i, param.__class__))
arcpy.AddMessage("GetParameter({0}).__class__.__name__ = {1}".format(i, param.__class__.__name__))
arcpy.AddMessage("GetParameterAsText({0}) = {1}".format(i, paramText))
inFeatureLayer = arcpy.GetParameterAsText(0)
#Überprüfen Sie den Inhalt des Feature-Layers
with arcpy.da.SearchCursor(inFeatureLayer, ["OID@", "SHAPE@"]) as cursor:
for row in cursor:
oid = row[0]
shape = row[1]
# oid
arcpy.AddMessage("*****************************************************************************************************")
arcpy.AddMessage("-- oid = OID@ --")
arcpy.AddMessage("OID@ = {0}".format(oid))
arcpy.AddMessage("OID@.__class__ = {0}".format(oid.__class__))
arcpy.AddMessage("OID@.__class__.__name__ = {0}".format(oid.__class__.__name__))
# shape
arcpy.AddMessage("-- shape = SHAPE@ --")
arcpy.AddMessage("shape = {0}".format(shape))
arcpy.AddMessage("shape.__class__ = {0}".format(shape.__class__))
arcpy.AddMessage("shape.__class__.__name__ = {0}".format(shape.__class__.__name__))
arcpy.AddMessage("shape.partCount = {0}".format(shape.partCount))
arcpy.AddMessage("shape.pointCount = {0}".format(shape.pointCount))
# shape.getPart()
arcpy.AddMessage("-- shape.getPart() --")
arcpy.AddMessage("shape.getPart() = {0}".format(shape.getPart()))
arcpy.AddMessage("shape.getPart().__class__ = {0}".format(shape.getPart().__class__))
arcpy.AddMessage("shape.getPart().__class__.__name__ = {0}".format(shape.getPart().__class__.__name__))
arcpy.AddMessage("shape.getPart().count = {0}".format(shape.getPart().count))
# shape.getPart().getObject(0)
arcpy.AddMessage("-- shape.getPart().getObject(0) --")
arcpy.AddMessage("shape.getPart().getObject(0) = {0}".format(shape.getPart().getObject(0)))
arcpy.AddMessage("shape.getPart().getObject(0).__class__ = {0}".format(shape.getPart().getObject(0).__class__))
arcpy.AddMessage("shape.getPart().getObject(0).__class__.__name__ = {0}".format(shape.getPart().getObject(0).__class__.__name__))
arcpy.AddMessage("shape.getPart().getObject(0).count = {0}".format(shape.getPart().getObject(0).count))
# shape.getPart().getObject(0).getObject(i)
for i in range(shape.getPart().getObject(0).count):
point = shape.getPart().getObject(0).getObject(i)
arcpy.AddMessage("-- point = shape.getPart().getObject(0).getObject({0}) --".format(i))
arcpy.AddMessage("point = {0}".format(point))
arcpy.AddMessage("point.__class__ = {0}".format(point.__class__))
arcpy.AddMessage("point.__class__.__name__ = {0}".format(point.__class__.__name__))
arcpy.AddMessage("*****************************************************************************************************")
del cursor
Bei Ausführung als Eingabe mit einem Feature-Layer, der zwei Polygone enthält.
GetArgumentCount() = 1
GetParameter(0) =Polygon testen
GetParameter(0).__class__ = <class 'arcpy._mp.Layer'>
GetParameter(0).__class__.__name__ = Layer
GetParameterAsText(0) =Polygon testen
*****************************************************************************************************
-- oid = OID@ --
OID@ = 1
OID@.__class__ = <class 'int'>
OID@.__class__.__name__ = int
-- shape = SHAPE@ --
shape = <geoprocessing describe geometry object object at 0x0000017A10D30EE0>
shape.__class__ = <class 'arcpy.arcobjects.geometries.Polygon'>
shape.__class__.__name__ = Polygon
shape.partCount = 1
shape.pointCount = 5
-- shape.getPart() --
shape.getPart() = <geoprocessing array object object at 0x0000017A1020A450>
shape.getPart().__class__ = <class 'arcpy.arcobjects.arcobjects.Array'>
shape.getPart().__class__.__name__ = Array
shape.getPart().count = 1
-- shape.getPart().getObject(0) --
shape.getPart().getObject(0) = <geoprocessing array object object at 0x0000017A1020A970>
shape.getPart().getObject(0).__class__ = <class 'arcpy.arcobjects.arcobjects.Array'>
shape.getPart().getObject(0).__class__.__name__ = Array
shape.getPart().getObject(0).count = 5
-- point = shape.getPart().getObject(0).getObject(0) --
point = 132.084696427 31.297648687 0 NaN
point.__class__ = <class 'arcpy.arcobjects.arcobjects.Point'>
point.__class__.__name__ = Point
-- point = shape.getPart().getObject(0).getObject(1) --
point = 135.36789933 32.2200581310001 0 NaN
point.__class__ = <class 'arcpy.arcobjects.arcobjects.Point'>
point.__class__.__name__ = Point
-- point = shape.getPart().getObject(0).getObject(2) --
point = 136.569792838 29.41042809 0 NaN
point.__class__ = <class 'arcpy.arcobjects.arcobjects.Point'>
point.__class__.__name__ = Point
-- point = shape.getPart().getObject(0).getObject(3) --
point = 133.286589935 28.4353141970001 0 NaN
point.__class__ = <class 'arcpy.arcobjects.arcobjects.Point'>
point.__class__.__name__ = Point
-- point = shape.getPart().getObject(0).getObject(4) --
point = 132.084696427 31.297648687 0 NaN
point.__class__ = <class 'arcpy.arcobjects.arcobjects.Point'>
point.__class__.__name__ = Point
*****************************************************************************************************
*****************************************************************************************************
-- oid = OID@ --
OID@ = 2
OID@.__class__ = <class 'int'>
OID@.__class__.__name__ = int
-- shape = SHAPE@ --
shape = <geoprocessing describe geometry object object at 0x0000017A10D308C8>
shape.__class__ = <class 'arcpy.arcobjects.geometries.Polygon'>
shape.__class__.__name__ = Polygon
shape.partCount = 1
shape.pointCount = 5
-- shape.getPart() --
shape.getPart() = <geoprocessing array object object at 0x0000017A1020AA50>
shape.getPart().__class__ = <class 'arcpy.arcobjects.arcobjects.Array'>
shape.getPart().__class__.__name__ = Array
shape.getPart().count = 1
-- shape.getPart().getObject(0) --
shape.getPart().getObject(0) = <geoprocessing array object object at 0x0000017A10F19CB0>
shape.getPart().getObject(0).__class__ = <class 'arcpy.arcobjects.arcobjects.Array'>
shape.getPart().getObject(0).__class__.__name__ = Array
shape.getPart().getObject(0).count = 5
-- point = shape.getPart().getObject(0).getObject(0) --
point = 146.643152231 39.990418811 0 NaN
point.__class__ = <class 'arcpy.arcobjects.arcobjects.Point'>
point.__class__.__name__ = Point
-- point = shape.getPart().getObject(0).getObject(1) --
point = 145.658068329 37.1688505340001 0 NaN
point.__class__ = <class 'arcpy.arcobjects.arcobjects.Point'>
point.__class__.__name__ = Point
-- point = shape.getPart().getObject(0).getObject(2) --
point = 142.19148511 38.2163059420001 0 NaN
point.__class__ = <class 'arcpy.arcobjects.arcobjects.Point'>
point.__class__.__name__ = Point
-- point = shape.getPart().getObject(0).getObject(3) --
point = 143.176569012 40.99087202 0 NaN
point.__class__ = <class 'arcpy.arcobjects.arcobjects.Point'>
point.__class__.__name__ = Point
-- point = shape.getPart().getObject(0).getObject(4) --
point = 146.643152231 39.990418811 0 NaN
point.__class__ = <class 'arcpy.arcobjects.arcobjects.Point'>
point.__class__.__name__ = Point
*****************************************************************************************************