Geoprocessing cursor object

762
0
11-22-2011 05:49 AM
RenataTapia
New Contributor
Help with this script: write a script that reads a Feature_Class alpenv_huuetten points and move the points with a way to indicate, in the direction of X and Y. Displaced points should be kept in a new data set. It is sufficient if it saved only the geometries of the points they have no additional boxes that attributes appear in the new data set. The entry of the offset distance in the direction X and Y must be solved dynamically.


import arcgisscripting
gp = arcgisscripting.create()

gp.overwriteOutput = 1
gp.Workspace = "C:\\Users\\mapa\\Desktop\\maestria\\PYTHON\\Salzburg.mdb\\"

gp.CreateFeatureclass_management(gp.workspace, "nuevos_puntos","POINT")
cur = gp.InsertCursor("nuevos_puntos")
pnt = gp.CreateObject("Point")
cur2 = gp.SearchCursor("C:\\Users\\mapa\\Desktop\\maestria\\PYTHON\\Salzburg.mdb\\alpenv_huetten")
pnt.X = raw_input("Distancia en X")

for row in cur2:

    pnt.X = row.getValue("Shape")
    pnt.Y = row.getValue("Shape")
    pnt = feat.getPart()
    feat.shape = pnt
    cur.newRow(row)
    while pnt:
        pnt = raw_input("Distancia en Y")
        print pnt.X, pnt.Y
        feat.shape = pnt      
   
feat = cur.newRow()
feat.shape = pnt
cur.insertRow(feat)
print "Calculo finalizado"
del cur
del cur2
del row
Tags (2)
0 Kudos
0 Replies