• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录

gisoracle

  • 博客园
  • 联系
  • 订阅
  • 管理

公告

View Post

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

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")

 

posted on 2019-05-10 19:37  gisai  阅读(215)  评论(0)    收藏  举报

刷新页面返回顶部
 
博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3