First, the TLDR digest:

  • I'm getting a bogus value from dataFrame.geographicTransformations on some machines; how do I get the correct value as shown in the properties dialog? and/or
  • Given a spatial reference with a PCS, how do I find out (in Python) the GCS or datum that it's based on?

And now the details...

(Reposted from http://forums.arcgis.com/threads/76061-getting-the-specified-geographic-transformation-or-at-least-the-GCS-of-a-data-frame)

I'm writing an arcpy script in ArcGIS Desktop 10.0. This script opens a user-specified MXD and processes user-specified layers in it. Part of the processing involves projecting the data from whatever GCS it's in, to whatever PCS the data frame has in its spatial reference.

Sometimes, the input GCS and the output PCS are in the same datum (e.g. WGS_1984), and so I don't need to supply a geographic transformation to the Project_management() tool. Other times, they are not in the same datum; e.g. the data frame coordinate system might be Europe_Lambert_Conformal_Conic, which uses the datum ED_1950.

If I don't supply the right geographic transformation (or lack thereof), the Project tool fails.

How do I know what transformation to use?

In the case where the datums are different, I can require that the data frame in the MXD file have a transformation method specified in its properties, e.g. ED_1950_To_WGS_1984_10.

If that was the end of the story, my job would be simple: if the data frame has a transformation method in its properties, pass that to Project_management(), otherwise omit that parameter. The script would just look at the value of dataFrame.geographicTransformations.

The problem is that on some machines, when I ask for mydataframe.geographicTransformations, I get a spurious value of "NAD_1927_To_NAD_1983_NADCON". So if the data frame has no transformation methods specified in its properties dialog, dataFrame.geographicTransformations returns ["NAD_1927_To_NAD_1983_NADCON"]. Which causes Project_management() to fail, if that transformation doesn't apply to the GCS and PCS actually being used. For example, when the data's GCS is GCS_WGS_1984, and the data frame's PCS is Asia_Lambert_Conformal_Conic, no geo transformation is needed (both have datum D_WGS_1984), and none is specified. So if I pass dataFrame.geographicTransformations[0] to Project_management() as the geographic transformation parameter, I will cause it to fail because the NAD transformation is inapplicable.

If the data frame does have a transformation method specified in its properties dialog, then (on these same machines) dataFrame.geographicTransformations returns a list with "NAD_1927_To_NAD_1983_NADCON" as the first element, followed by the one specified in the properties dialogue.

Again, this is on some machines. On others, the spurious "NAD_1927_To_NAD_1983_NADCON" doesn't appear, so I can rely on dataFrame.geographicTransformations to be set, or not, as appropriate.

So my question is, where is this spurious transformation coming from, and how do I get rid of it, so that if I don't need a transformation, I can avoid passing a bad one to Project_management()? There's nothing in the Environment Settings under Output Coordinates / Geographic Transformations.

Or, if I can't get rid of it ... maybe I can detect when the data's GCS and the data frame's PCS have the same datum, so I don't need a geographic transformation. In that case I would just not pass any such parameter to Project_management().

The trouble with that approach is, I don't know how to get the datum, or the GCS, of a PCS spatial reference. I can look at dataframe.spatialReference.PCSCode, but spatialReference.GCSCode, GCSname, datumCode and datumName are blank (see http://help.arcgis.com/en/arcgisdesk...00000p6000000/ - these properties are only available with a GCS). I know that ArcGIS desktop knows the GCS being used by the data frame, because when I open data frame properties, the Coordinate System tab tells me not only the PCS but also the GCS (including datum). But the GCS is not available thru dataframe.spatialReference, that I can tell.

So, if someone could tell me

  • how to accurately find the specified geographic transformation of the data frame (i.e. get rid of the uninvited NAD geographic transformation) (this would be the preferred solution); and/or
  • how to determine the GCS or datum of a PCS (can my script look it up in some standard place, based on the PCS code?)

... I would be very appreciative.

  • 2
    +1 You have some great questions here, although I recommend that you pare down much of the text to make the post more succinct.
    – Aaron
    Commented Jan 25, 2013 at 15:39
  • 1
    Every PCS has an associated GCS, which can be found via IProjectedCoordinateSystem.GeographicCoordinateSystem. Have you tried that? Commented Jan 25, 2013 at 15:47
  • @KirkKuykendall, thanks for this suggestion, and confirmation that every PCS has an associated GCS. That property would be perfect, if I could get to it. You linked to an ArcObjects API Reference for .NET... is it possible to access ArcObjects from Python? Any links to info on that?
    – LarsH
    Commented Jan 25, 2013 at 15:58
  • @Aaron, your point is well taken ... if I were encountering this wall of text I would not be highly motivated to read it. However it is a complicated question and it takes detail to lay the context and describe the problem accurately. Any suggestions on how to pare it down? I tried breaking it into small paragraphs and putting the key issues in bold...
    – LarsH
    Commented Jan 25, 2013 at 16:00
  • 1
    See arcobjects code here for dealing with geotransformations. Commented Jan 25, 2013 at 16:19

1 Answer 1


Given a spatial reference with a PCS, how do I find out (in Python) the GCS or datum that it's based on?

10.1 code below. This functionality is new at 10.1

>>> sr = arcpy.SpatialReference('NAD 1983 HARN UTM Zone 11N')
>>> sr.type
>>> sr.GCS
<SpatialReference object at 0xe263830[0xd76adb8]>
>>> sr.GCS.GCSName
>>> sr.GCS.datumName
>>> sr.GCS.datumCode

how do I get the correct value as shown in the properties dialog? ListTransformations (new at 10.1) uses the same logic. Though i'm not sure if it uses the extent. doc for ListTransformations

>>> sr2 = arcpy.SpatialReference('NAD 1927 StatePlane California VI FIPS 0406')
>>> print (arcpy.ListTransformations(sr, sr2))
[u'WGS_1984_(ITRF00)_To_NAD_1983_HARN + NAD_1927_To_WGS_1984_79_CONUS',...
  • Thanks for the answers. Unfortunately, as mentioned in the question, I am using 10.0, so this won't help me at present. However we will probably upgrade soon, and it's good to know that this will be covered then.
    – LarsH
    Commented Jan 26, 2013 at 2:27
  • ListTransformations() looks useful, though it doesn't sound like it gets the transformation specified in the data frame properties.
    – LarsH
    Commented Jan 26, 2013 at 2:33

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.