首页 > 其他 > 详细

以下示例使用一个 x,y 坐标列表创建了一个多边形几何对象。然后使用裁剪工具来裁剪具有多边形几何对象的要素类。

时间:2019-05-10 19:55:48      阅读:201      评论:0      收藏:0      [点我收藏+]
import arcpy

# Create an Array object.
#
array = arcpy.Array()

# List of coordinates.
#
coordList = [1.0;1.0,1.0;10.0,10.0;10.0,10.0;1.0]

# For each coordinate set, create a point object and add the x- and 
#   y-coordinates to the point object, then add the point object 
#   to the array object.
#
for coordPair in coordList:
    x, y = coordPair.split(";")
    pnt = arcpy.Point(x,y)
    array.add(pnt)

# Add in the first point of the array again to close the polygon boundary
#
array.add(array.getObject(0))

# Create a polygon geometry object using the array object
#
boundaryPolygon = arcpy.Polygon(array)

# Use the geometry to clip an input feature class
#
arcpy.Clip_analysis("c:/data/rivers.shp", boundaryPolygon, "c:/data/rivers_clipped.shp")

 

以下示例使用一个 x,y 坐标列表创建了一个多边形几何对象。然后使用裁剪工具来裁剪具有多边形几何对象的要素类。

原文:https://www.cnblogs.com/gisoracle/p/10846368.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!