Quantcast
Channel: Forums - Python
Viewing all articles
Browse latest Browse all 2485

How to create a shapefile from a python list using ArcPy?

$
0
0
I've been looking for a way to create a shapefile from a python list (in the case below, uniqueList).

Basically, I have been using SearchCursor's to iterate through a shapefile, and I would like to export the result as a shapefile...I tried CopyFeatures...but it didn't even return a blank file (it returned nothing).

Code:

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)


Viewing all articles
Browse latest Browse all 2485

Trending Articles