I saw a posting from 2012 that answered the question if SHAPE@X or SHAPE@Y or SHAPE@XY could be used in forming the where_clause in an arcpy.da.XCursor (search, update or insert)
Now that it's 2015, I'm wondering if that's still correct.
We have some data with NULLS in the ShapePoint data and I'm flipping them all to 0,0 in our state plane projection by:
fields = ['OID@', 'SHAPE@X', 'SHAPE@Y','SP_ID' ] with arcpy.da.UpdateCursor(myFC, fields) as cursor : for row in cursor: if row[1] == None or row[1] == 0.0 or row[2] == None or row[2] == 0.0 : row[1] = 0.0 row[2] = 0.0 cursor.updateRow(row) |
I thought it would be cleaner to have a query string in the UpdateCursor but so far I've had no luck with
queryString = '"SHAPE@X" = NULL or "SHAPE@X" = 0 or "SHAPE@Y" = NULL or "SHAPE@Y" = 0' or queryString = 'SHAPE@X = NULL or SHAPE@X = 0 or SHAPE@Y = NULL or SHAPE@Y = 0' |
or other variations thereof.
I've concluded that using the SHAPE part of a geodatabase in a da.Cursor query string is just not possible.
Is that correct?
Any suggestions?