首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >请求: ArcMap中的数据处理自动化

请求: ArcMap中的数据处理自动化
EN

Stack Overflow用户
提问于 2019-03-05 17:08:39
回答 1查看 40关注 0票数 1

我的python技能非常有限(没有),我从未为ArcMap创建过一个自动化的、连续的请求。下面是我想要编写的步骤,任何建议都将不胜感激。

  1. 查找文件文件夹
  2. 导入“第一个”文件(表csv) (有超过500个cvs,命名约定不是顺序的)
  3. 将csv连接到HUC08 shapefile
  4. 在字段名“name”下选择无空值的数据
  5. 将选定的数据保存为FoTX.gdb中的图层文件
  6. 移动到文件夹中的下一个文件,并完成相同的操作,直到所有操作完成为止。
EN

回答 1

Stack Overflow用户

发布于 2019-03-13 22:31:29

代码语言:javascript
复制
#Part of the code. The rest depends mostly on your data
#Set environment settings
arcpy.env.workspace = 'C:/data' #whatever it is for you. you can do this or not


import os, arcpy, csv

   mxd = arcpy.mapping.MapDocument("CURRENT")
   folderPath=os.path.dirname(mxd.filePath)

   #Loop through each csv file
    count = 0

    for f_name in os.listdir(folderPath):
      fullpath = os.path.join(folderPath, f_name)
      if os.path.isfile(fullpath):
       if f_name.lower().endswith(".csv"):
             #import csv file and join to shape file code here

             # Set local variables
             in_features = ['SomeNAME.shp', 'SomeOtherNAME.shp'] # if there are more 
                                                                 #then one
             out_location = 'C:/output/FoTX.gdb'
             # out_location =os.path.basename(gdb.filePath) #or if the gdb is in the 
                                                            #same folder as the csv 
                                                            #files

             # Execute FeatureClassToGeodatabase
             arcpy.FeatureClassToGeodatabase_conversion(in_features, out_location)

    if count ==0:
      print "No CSV files in this folder"
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/55008114

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档