【问题标题】:Create a shapefile from a python list using ArcPy?使用 ArcPy 从 python 列表创建 shapefile?
【发布时间】:2014-06-06 09:54:54
【问题描述】:

我一直在寻找一种从 python 列表(在下面的例子中为 uniqueList)创建 shapefile 的方法。

基本上,我一直在使用 SearchCursor 来遍历 shapefile,我想将结果导出为 shapefile...我尝试了 CopyFeatures...但它甚至没有返回空白文件(它什么也没返回)。

import arcpy

def find_overlaps(input_features, output_features):
   uniqueList = []
   for row in arcpy.da.SearchCursor(input_features, ('OBJECTID', 'SHAPE@', 'name')):
      foundMatch = False
      for row2 in uniqueList:
          if row[1].equals(row2[1]):
              foundMatch = True
              break
      if foundMatch == False
          uniqueList.append(row)
   return uniqueList
   ## no work ##
   arcpy.management.CopyFeatures(uniqueList, output_features)

【问题讨论】:

    标签: python-2.7 gis arcgis esri arcpy


    【解决方案1】:

    我认为您必须先创建要素类。使用 arcpy.CreateFeatureclass_managment()。在此功能中,您可以使用模板功能来指定字段。您可以使用您的 inputp_features,如果您只想要选定的字段,您可以使用 arcpy.MakeFeatureLayer_management (),应该可以工作。或者,您可以创建不带字段的要素类,然后使用 arcpy.AddField_management() 添加所需的字段。对于准确的语法检查帮助,几乎没有有用的示例。

    祝你好运。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-03-07
      • 1970-01-01
      • 2022-10-18
      • 2019-09-24
      • 2021-05-14
      • 1970-01-01
      • 2011-05-06
      • 1970-01-01
      相关资源
      最近更新 更多