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

gisoracle

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

公告

View Post

arcgis10寻宝 使用一个图层切割一个数据集下所有数据

arcgis10寻宝 使用一个图层切割一个数据集下所有数据

arcgis10寻宝 使用一个图层切割一个数据集下所有数据

# Script Name: Clip Multiple Feature Classes  by giosracle
# Description: Clips one or more shapefiles
#              from a folder and places the clipped
#              feature classes into a geodatabase.
# Created By:  Insert name here.
# Date:        Insert date here.

# Import ArcPy site-package and os modules
#
import arcpy
import os

# Set the input workspace
#
arcpy.env.workspace = arcpy.GetParameterAsText(0)

# Set the clip featureclass
#
clipFeatures = arcpy.GetParameterAsText(1)

# Set the output workspace
#
outWorkspace = arcpy.GetParameterAsText(2)

# Set the XY tolerance
#
clusterTolerance = arcpy.GetParameterAsText(3)

try:
    # Get a list of the featureclasses in the input folder
    #
    fcs = arcpy.ListFeatureClasses()

    for fc in fcs:  
        # Validate the new feature class name for the output workspace.
        #
        featureClassName = arcpy.ValidateTableName(fc, outWorkspace)
        outFeatureClass = os.path.join(outWorkspace, featureClassName)
       
        # Clip each feature class in the list with the clip feature class.
        # Do not clip the clipFeatures, it may be in the same workspace.
        #
        if fc <> os.path.basename(clipFeatures):
            arcpy.Clip_analysis(fc, clipFeatures, outFeatureClass,
                                clusterTolerance)

except:
    arcpy.AddMessage(arcpy.GetMessages(2))
    print arcpy.GetMessages(2)

posted on 2011-05-27 09:54  gisai  阅读(1402)  评论(0)    收藏  举报

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