+ Reply to Thread
Results 1 to 3 of 3

Thread: getting the specified geographic transformation, or at least the GCS, of a data frame

  1. #1
    Lars Huttar
    Join Date
    May 2010
    Posts
    30
    Points
    1
    Answers Provided
    0


    0

    Default getting the specified geographic transformation, or at least the GCS, of a data frame

    Hi all,

    I have a script that 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 Project_management().
    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.

    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 it's not available thru dataframe.spatialReference, that I can tell.

    So, if someone could tell me
    1. how to get rid of the uninvited NAD geographic transformation (preferred); and/or
    2. how to determine the GCS or datum of a PCS (can I look it up in some standard place?)
    I would be very appreciative.

    I'm using ArcGIS Desktop 10.0 by the way.

    Thanks,
    Lars
    Last edited by huttarl; 01-25-2013 at 05:24 AM. Reason: clarify title

  2. #2
    Chris Fox

    Join Date
    Oct 2009
    Posts
    523
    Points
    302
    Answers Provided
    36


    1
    This post is marked as the answer

    Default Re: getting the specified geographic transformation, or at least the GCS, of a data f

    Hi Lars,

    You probably won't like this answer but this is all so much easier at 10.1. At 10.1 sp1 we made a change so the NADCON transformation will no longer be added to the map by default, so it won't show up unless the transformation was actually set by the user. In addition, at 10.1 we added a new function call ListTransformations:

    http://resources.arcgis.com/en/help/...000001p000000/

    It allows you to specify an input spatial ref, output spatial ref and optional extent object and it will return a list of all the valid transformations for the from and to spat ref. With this list you could compare what is in the map and select the match.
    Chris Fox
    Esri

  3. #3
    Lars Huttar
    Join Date
    May 2010
    Posts
    30
    Points
    1
    Answers Provided
    0


    0

    Default Re: getting the specified geographic transformation, or at least the GCS, of a data f

    Quote Originally Posted by Chris_Fox View Post
    You probably won't like this answer but this is all so much easier at 10.1. At 10.1 sp1 we made a change so the NADCON transformation will no longer be added to the map by default, so it won't show up unless the transformation was actually set by the user.
    Hi Chris, thanks for the reply. That does clarify for me why I'm getting the NADCON transformation, when it's not in the data frame properties.

    For now my workaround is to (1) try projecting using the transformation returned by dataframe.transformations[0]; and (2) if it didn't work, and the transformation is the NAD one, retry projecting without the transformation.

    I will look forward to these improvements in 10.1... we should be upgrading soon.
    Last edited by huttarl; 02-01-2013 at 07:23 AM. Reason: fixed typo

+ Reply to Thread

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts