sinje

Problem with copy features toll after dissolve

Discussion created by sinje on Apr 13, 2011
Hi everybody,

I have a strange effect:
I make some polylines, dissolve them to one line and append this dissolved line to a list. This I do for example 3 times.
So in the end I have a list of 3 (dissolved) lines.
When I save these as a feature class with CopyFeatures_management or Merge_management (same effect) I get the first line in the list three times instead of the three different lines. But when I save them separately as three feature classes it works well.

Here is a code with dummy-coordinates which produces this effect:

import arcpy
import arcgisscripting
from arcpy import env
workspace = "F:\\..."
arcpy.env.workspace = workspace


featureList = []
coordList = [[[[1,2], [3,7]],[[4,7], [11,5]]],[[[11,12], [13,17]],[[14,17], [21,15]]]]

for l in coordList:
    point = arcpy.Point()
    array = arcpy.Array()

    polyline_list = []

    for i in range(0,2):
        for feature in l:

            for coordPair in feature:
                point.X = coordPair[0]+i
                point.Y = coordPair[1]+i
                array.add(point)

            polyline = arcpy.Polyline(array)
            array.removeAll()
            polyline_list.append(polyline)

    line_geom = arcpy.Geometry()
    lines = arcpy.Dissolve_management(polyline_list, line_geom)
    featureList.append(lines[0])

# with this I get 2 times the first polyline in the list instead of the 2 different lines:
arcpy.CopyFeatures_management(featureList, "lines")

# with this I get the 2 different lines correctly:
for feature in featureList:
    scratch_Name = arcpy.CreateScratchName("single_line", "", "FeatureClass")
    arcpy.CopyFeatures_management(feature, scratch_Name)



any ideas??

Thanks for your help,

Selda

Outcomes