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

add attributes to newly created shapefile from existing shapefile using arcpy

$
0
0
I have a paretn layer with multiple table entries and want to select first row and paste it into another (target layer) table. Parent table will change after each run of geoprocessing and I want to get the first row every time and paste it to target layer. Both tables have different number of fields and I want to have FID, Shape, and id fields in target layer. Following is piece of code that I am trying to work to accomplish this:

Code:

Import arcpy
ofc = "C:/outFC.shp"
ifc = "C:/inFC.shp"
fields = arcpy.ListFields(ifc,"*","ALL")
for f in fields:
    shape = f.Shape
    query = '"Shape" = \'' + str(shape) + '\''
    cur = arcpy.UpdateCursor(ofc,query)

del f, fields


Viewing all articles
Browse latest Browse all 2485

Trending Articles