7

I have been searching for the easiest way to convert a single set of State Plane Coordinates (in units of "Feet") to Decimal Degrees using arcpy. All the methods I have seen so far involve one of the following ...
1. Installing a Library like pyproj
2. Creating (or starting with?) a feature class or table to project with "Project_management" or "ConvertCoordinateNotation_management".
3. Using more math than I care to ... and some sort of Haversine or Vincenty algorithm?

I really only want to convert one set of coordinates that I have already arrived at in my python script (using arcpy.mapping). If I have to I suppose I can create a table or feature class out of them in order to then read in the table or feature class and project that but that seems ridiculous. Having recently done exercises using the "utm" module where this kind of thing was really easy, I don't understand why I should have to jump through hoops to convert a single set of coordinates. Shouldn't arcpy provide a way to do this? If one of the above is the only way for me to do it, then that is what I will do. Installing the library seems easiest but I'm not sure how to install a module in the version of Python that I use in ArcMap (I have done it with PIP in the python I have in the OSGeo4W shell).

Reference Links:
Search Cursor Solution w/ pyproj link also
Adding XY Data
UTM module

1
  • in what format are these coordinates?
    – mr.adam
    Commented May 26, 2015 at 16:37

1 Answer 1

10

If you have the XY of the point, then you could create a PointGeometry.

current_sr = arcpy.SpatialReference(102726) #Enter the current WKID for the point
new_sr = arcpy.SpatialReference(4326) #This is the WKID for WGS84

point = arcpy.PointGeometry(arcpy.Point(7334719, 670307), current_sr)

new_point = point.projectAs(new_sr)

>>> new_point.firstPoint.X = -123.88118364456213
>>> new_point.firstPoint.Y = 45.45548227993378

Documentation for PointGeometry

Be aware the projectAs method can also take a transformation name if needed:

projectAs(spatial_reference, {transformation_name})

Projects a geometry and optionally applies a geotransformation.

To project, the geometry needs to have a spatial reference, and not have an UnknownCoordinateSystem. The new spatial reference system passed to the method defines the output coordinate system. If either spatial reference is unknown the coordinates will not be changed. The Z- and measure values are not changed by the ProjectAs method.

1
  • 1
    This sounds like precisely what I'm looking for. Perhaps, my search phrases, were not doing the job. Let me try this. Commented May 26, 2015 at 16:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.