Select to view content in your preferred language

Listing Transformations for an Area with ArcMap and ArcPy

2962
0
09-29-2014 01:04 AM
Labels (1)
SimonKettle
Frequent Contributor
1 0 2,962

A common question asked when working with Coordinate Reference Systems (CRS) in ArcMap is not only how to transform between different CRS but simply what transformations are available between two CRS in a given area?

There are several ways of finding this information with ArcMap:

PDF resources found in your ArcMap installation:

C:\Program Files (x86)\ArcGIS\Desktop10.2\Documentation\projected_coordinate_systems.pdf

C:\Program Files (x86)\ArcGIS\Desktop10.2\Documentation\geographic_transformations.pdf

C:\Program Files (x86)\ArcGIS\Desktop10.2\Documentation\geographic_coordinate_systems.pdf

Using the OGP EPSG Area Polygons:

OGP's EPSG Area Polygons as Searchable Layers which is available to download from here @exprodat

blog_epsg_areapoly_image1.jpgUsing the ListTransformation and SpatialReference Object

The spatial reference object allows you to interrogate a layer, features class, shapefile, raster or a coordinate reference name to view or manipulate a spatial object's properties. These include spheroidName, datumName, projectionName, scaleFactor and many more.

In the below example the code interrogates the names of two projections systems, prints their spheroid name, geodetic datum and a list of transformations that are valid between the two projection systems within the specified extent.

# Define from and to Spatial Reference names
fromSpatRef = arcpy.SpatialReference('European Datum 1950 UTM Zone 31N')
toSpatRef = arcpy.SpatialReference('WGS 1984 UTM Zone 31N')

# Print the spheroid name for fromSpatRef and toSpatRef
print("from SpatRef spheroid: " + fromSpatRef.GCS.spheroidName)
print("to SpatRef spheroid: " + toSpatRef.GCS.spheroidName)

# Print the datum name for for fromSpatRef and toSpatRef
print("from SpatRef datum: " + fromSpatRef.GCS.datumName)
print("to SpatRef datum: " + toSpatRef.GCS.datumName)

# Extent for Central North Sea (values can be found in the data frame)
extent = arcpy.Extent(533553, 6469886, 993268, 6179505)

# list transformations valid for Central North Sea region
outlist = arcpy.ListTransformations(fromSpatRef , toSpatRef, extent)
print str(outlist)
       

This prints the following information:

from SpatRef spheroid: International_1924

to SpatRef spheroid: WGS_1984

from SpatRef datum: D_European_1950

to SpatRef datum: D_WGS_1984

[u'ED_1950_To_WGS_1984_1', u'ED_1950_To_WGS_1984_NGA_7PAR', u'ED_1950_To_WGS_1984_18', u'ED_1950_To_WGS_1984_2', u'ED_1950_To_WGS_1984_24', u'ED_1950_To_WGS_1984_25', u'ED_1950_To_ETRS_1989_4 + ETRS_1989_To_WGS_1984', u'ED_1950_To_WGS_1984_7', u'ED_1950_To_WGS_1984_36', u'ED_1950_To_WGS_1984_32_incorrect_DS', u'ED_1950_To_WGS_1984_32']

       

The ListTransformations function provides access to the list of transformations for a given area between any projection systems.

With this information it is possible to see a cut down list of what transformations are appropriate between any two CRS for a given area and investigate which of these is the appropriate method.

Further to this the syntax for a transformation method can be easily copy and pasted into other tools such as the Project Tool‌ and can be used within a script such as the below.

# Set variables XY values can be presented as a list
x = 309905
y = 6320846
srIn = 'European Datum 1950 UTM Zone 31N'
srOut = 'WGS 1984 UTM Zone 31N'
Transform = 'ED_1950_To_WGS_1984_18'

# Create point geometry from xy variables and project to   srOut with Tranform method
pointGeometry = arcpy.PointGeometry(arcpy.Point(x,y),srIn,False, False)
projectedPoint = pointGeometry.projectAs(srOut, Transform)

# Copy the reprojected points to a shapefile
arcpy.CopyFeatures_management(projectedPoint,r"C:\Users\Documents\ArcGIS\Wells.shp")
      
About the Author
Geologist, Geospatial Expert and TAP Certified GIS Trainer working as an Independant Consultant. I have special interests in Geology, Exploration, Coordinate Reference Systems, Geodesy and Natural Science.