Sorting of arcpy.ListTransformations result list

01-16-2017 08:16 AM
New Contributor III

We are currently using a python dictionary which contains the transformation names with best accuracy for defined source and target coordinate systems for several python scripts where coordinate transformations have to be performed automatically. As we are getting data from lots of different countries with different source coordinate sytems, we were wondering if "arcpy.ListTransformations" could be of any help for us. Does anyone know, if the result list of this function is sorted by accuracy, so that the first list item could be used as default tranformation method? I've done some tests with a few coordinates that gave me that impression, but unfortunately the german ESRI Support neither wanted to confirm nor to deny it.

0 Kudos
1 Reply
Esri Esteemed Contributor

The Help doesn't mention it. However, if I compare the results for a specific Colombian case, using this code:

import arcpy

extent = arcpy.Extent(-76, 5, -75, 6)
sr_wgs84 = arcpy.SpatialReference(4326)
sr_magna = arcpy.SpatialReference(4686)
lst_trans = arcpy.ListTransformations(sr_wgs84, sr_magna, extent)

for trans in lst_trans:
    print trans

It will result this list:

Bogota_To_MAGNA_Region_5_CF + Bogota_To_WGS_1984_Region_5_CF
Bogota_To_MAGNA_Region_5_MB + Bogota_To_WGS_1984_Region_5_CF
Bogota_To_MAGNA_Region_5_CF + Bogota_To_WGS_1984
Bogota_To_MAGNA_Region_5_MB + Bogota_To_WGS_1984
Bogota_To_MAGNA_Region_5_CF + Bogota_To_WGS_1984_Region_6_CF
Bogota_To_MAGNA_Region_6_CF + Bogota_To_WGS_1984_Region_5_CF
Bogota_To_MAGNA_Region_6_CF + Bogota_To_WGS_1984_Region_6_CF
Bogota_To_MAGNA_Region_5_MB + Bogota_To_WGS_1984_Region_6_CF
Bogota_To_MAGNA_Region_6_MB + Bogota_To_WGS_1984_Region_5_CF
Bogota_To_MAGNA_Region_6_MB + Bogota_To_WGS_1984_Region_6_CF
Bogota_To_MAGNA_Region_6_CF + Bogota_To_WGS_1984
Bogota_To_MAGNA_Region_6_MB + Bogota_To_WGS_1984

If I manually check this in ArcMap it shows the same order:

I am pretty sure you can assume that the returned order will represent the order provided in the interface of ArcMap.

However, there may be cases where you will prefer to use a different transformation than the default (first) one provided by the order.