ArcGIS Pro Python根据要素名查找要素
Posted gisoracle
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ArcGIS Pro Python根据要素名查找要素相关的知识,希望对你有一定的参考价值。
#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根据要素名查找要素的主要内容,如果未能解决你的问题,请参考以下文章
ArcGIS Pro风暴ArcGIS Pro 2.5质量检查:拓扑创建与编辑案例教程