rogerloweth

Projection with cursors

Discussion created by rogerloweth on Aug 9, 2011
Latest reply on Aug 15, 2011 by mzcoyle
According to the ArcGIS 10 help, one should be able to re-project using cursors thus:

#update cursor to fc and input lat lon
    rows = arcpy.UpdateCursor(fc, inCRS)
    for row in rows:
        pnt = arcpy.Point()
        pnt.X = lon_value
        pnt.Y = lat_value
        row.shape = pnt
        row.shape = pnt
        rows.updateRow(row)
    del row, rows
    #project to outGEOGCS
    rows = arcpy.SearchCursor(fc, outGEOGCS)
    for row in rows:
        feat = row.shape
        coord = feat.getPart()
        longitude = coord.X
        latitude = coord.Y
    del row, rows
    #project to outPROJCS
    rows = arcpy.SearchCursor(fc, outPROJCS)
    for row in rows:
        feat = row.shape
        coord = feat.getPart()
        easting = coord.X
        northing = coord.Y
    del row, rows

This code attempts to read in a point in one CRS and transform it to a different datum and then to another projection.

I get no errors but the re-projection simply does not work. Unfortunately I can't use the GDAL/OGR libraries in my corporate environment (I wish I could!!).

Anyone know of a workaround please??

Also, this is DESPERATELY slow!!

Roger

Outcomes