Convert cursor output to list of geometries

المشرف العام

Administrator
طاقم الإدارة
I want to convert all the geometries returned by search cursor to a list.

import mathimport arcpyfrom arcpy import envenv.workspace = r"C:\GIS Data\GIS data_for Maeenul vai"desc = arcpy.Describe("River.shp")shapefieldname = desc.ShapeFieldNamerows = arcpy.SearchCursor("River.shp")featureList = []for row in rows: feat = row.getValue(shapefieldname) featureList.append(feat) print "%i %i" % (feat.firstPoint.X, feat.firstPoint.Y) print print "%i %i" % (feat.lastPoint.X, feat.lastPoint.Y) print printdel row, rowsprint "---------------------------------------------------------------"for feat in featureList: print "%i %i" % (feat.firstPoint.X, feat.firstPoint.Y) print print "%i %i" % (feat.lastPoint.X, feat.lastPoint.Y) print print printOutput is

3610930 2135882 3611593 2134453

3611806 2134981 3611593 2134453

3614160 2136164 3617432 2131734

3611593 2134453 3617432 2131734

3617432 2131734 3620568 2127591

3620568 2127591 3620785 2127423

3617980 2126657 3620568 2127591

3616768 2129454 3617948 2126649

3617948 2126649 3617980 2126657

3615102 2128889 3617587 2126510

3617587 2126510 3617948 2126649

3617624 2126416 3617980 2126657

3613129 2128176 3615155 2125617

3615155 2125617 3617587 2126510

3615086 2125515 3615155 2125617

List Data

3615086 2125515 3615155 2125617

3615086 2125515 3615155 2125617

3615086 2125515 3615155 2125617

3615086 2125515 3615155 2125617

3615086 2125515 3615155 2125617

3615086 2125515 3615155 2125617

3615086 2125515 3615155 2125617

3615086 2125515 3615155 2125617

3615086 2125515 3615155 2125617

3615086 2125515 3615155 2125617

3615086 2125515 3615155 2125617

3615086 2125515 3615155 2125617

3615086 2125515 3615155 2125617

3615086 2125515 3615155 2125617

3615086 2125515 3615155 2125617

So basically the append methods of list only copies the last element returned by cursor to the whole list. How can I resolve this?



أكثر...
 
أعلى