码迷,mamicode.com
首页 > 编程语言 > 详细

ArcGIS Pro Python根据要素名查找要素

时间:2020-06-19 23:29:17      阅读:122      评论:0      收藏:0      [点我收藏+]

标签:code   env   查找   span   ndt   color   utf8   list   text   

#coding=utf8
import arcpy

import os
import sys
import math
from arcpy.sa import *

def FindFC(indir,FindText):

    arcpy.env.workspace = indir
    workspaces = arcpy.ListWorkspaces("*", "FileGDB")
    for workspace in workspaces:
        arcpy.AddMessage(u"gdb数据:"+workspace)
        FCMain(workspace, FindText)
        #arcpy.Compact_management(workspace)
    arcpy.env.workspace = indir
    workspaces = arcpy.ListWorkspaces("*", "Access")
    for workspace in workspaces:
        arcpy.AddMessage(u"mdb数据:"+workspace)
        FCMain(workspace, FindText)
        #arcpy.Compact_management(workspace)
    arcpy.env.workspace = indir
    workspaces = arcpy.ListWorkspaces("*", "Folder")
    for workspace in workspaces:
        #arcpy.AddMessage(u"Folder:"+workspace)
        FindFC(workspace,FindText)



def FCMain(inworkspace,FindText):
    arcpy.env.workspace = inworkspace

    Features =arcpy.ListFeatureClasses()
    for Feature in Features:
        if Feature.upper().find(FindText)>-1:
            arcpy.AddMessage("============="+Feature)
        #arcpy.Copy_management(Feature, outworkspace+os.sep+Feature)
    #Tables =arcpy.ListTables()
    #for Table in Tables:
    #    arcpy.AddMessage(Table)
    #    arcpy.Copy_management(Table, outworkspace+os.sep+Table)


indir=arcpy.GetParameterAsText(0)
FindText=arcpy.GetParameterAsText(1).upper()
FindFC(indir,FindText)

 

ArcGIS Pro Python根据要素名查找要素

标签:code   env   查找   span   ndt   color   utf8   list   text   

原文地址:https://www.cnblogs.com/gisoracle/p/13166572.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!