Add a function for projection of coordinate in arcgisscripting and arcpy

09-02-2010 06:35 AM
Status: Already Offered
Labels (1)
New Contributor III

Add a function for projection on the fly for coordinates in a python script

The spatial reference optional argument on the cursors support this capability i.e. your feature class will be opened projected.  Another possibility is use of the OutputCoordinateSystem environment setting which will (in most cases) perform a projection as part of the tool operation.  Note that this is specifically for projection handling and not for datum transformation YMMV.
I am porting one of my Python apps from a pure open source GIS solution into an arcpy-based solution.  I use python dictionaries to track coordinates and attributes and to retrieve and manipulate them until all the data is read.  I must transform all the coordinates one-by-one to a common datum in order to make decisions like maximum X, etc.  My software is getting unbelievably complicated trying to work around arcpy's lack of a simple function to accomplish a single-point transformation.  I see other developers on the web having complained about this for many years.  I will resent having to bundle gdal/ogr/proj4 files or corpscon files into my solution.  It shouldn't be so complicated.
Status changed to: Already Offered

Thank you for your suggestion for adding a function for projection on the fly for coordinates in a Python script. Unfortunately, this idea became buried over time. We acknowledge that our response is very overdue, however, we have been gradually improving our capabilities in this area.

We would like to inform you that the current version of ArcPy has several features that should address the requirements expressed in these comments, such as:

  • The spatial reference parameter on arcpy.da Cursors, which allows you to specify the output coordinate system and datum transformation when opening a cursor.
  • The arcpy.Geometry.ProjectAs method, which allows you to project individual coordinates.
  • The arcpy.fromCoordString and arcpy.Point.toCoordString methods, which allow you to convert between coordinate strings and Point objects.
  • The memory workspace, which allows you to perform spatial analysis and projection on data in memory without the need to persist a projected feature class until you are ready.
  • The OutputCoordinateSystem environment variable, which allows you to specify the output coordinate system for many tools, which will perform the projection as part of the tool operation.

We hope that these features will meet your needs and make it easier for you to perform projection on the fly for coordinates in your Python script. We appreciate your feedback and we are always looking for ways to improve our capabilities. If you have any further questions or concerns, please do not hesitate to contact us.