I have a point feature in a feature class that is being accessed by ArcPy. The point is projected but I need to find an efficient means to get the unprojected latitude and longitude for this point. Is there a method other than reprojecting (unprojecting), getting a search cursor on the new feature class, finding the feature, then getting the lat/lon off the feature's shape?
|
The SearchCursor supports specifying a spatial reference- in this case, you'd want a Geographic Coordinate System, such as WGS 1984. Then you iterate through the cursor and grab the x & y from the shape. http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/SearchCursor/000v00000039000000/ |
|||
|
|
|
Whether you call it projection or not, I am pretty sure that by definition, when you are translating the coordinate values from one spatial reference system to another, you are re/un-projecting. I am not that familiar with ArcPY, but in arcgisscripting at 9.3, you would have to project the whole feature class. Depending on how complex of a projection/transormation algorithm you need, you could always roll your own projection for the coordinates in basic python math. This would allow you to to coordinate value projection at the feature level. If you were open to using the OGR python bindings, you can project at the feature level within something like a 'search cursor'. |
|||||||||||
|
|
At ArcPy 10.0 there's no ability to project individual geometries. However, you can create a feature set (or an in-memory feature class) and project that instead of a full-blown feature class in a workspace on disk or in a database somewhere. |
|||
|
|
To elaborate on James's suggestion, here is a minimal code example using Python/arcpy:
|
|||
|
|