1

I am bringing data from SQL Server into ArcMap with ArcObjects as a Query Layer. If I do this manually, a 'Geographic Coordinate System Transformations' UI pops up. I would like the same thing to happen when I use my code OR to be able to set the transformation automatically. But I'm having trouble finding how to handle on the fly transformations with ArcObjects. Can someone point me in the right direction?

Edit: This is a Python Addin that I am developing. I'm using comtypes to get at the ArcObjects. Please tell me if I'm wrong but it seems that the simplest way to set the transformations is with arcpy.mapping.DataFrame.geographicTransformations. Then I can append to the list the transformations I want the dataframe to use, depending on which Query Layers are being asked for.

I would still like to have the same dialog that is used when manually setting the DataFrame's Geographic Transformations pop up after the data is brought into the map so the user is aware of what transformations are being used. Does someone know if this is possible?

Edit2: Maybe if I could trigger the event that warns the user that a featureclass with a differing projection than the dataframe has been added to the map. Where would I go to start looking into this?

  • Search around for IGeoTransformation (and maybe edit your question to mention this as well). Here's some code: gis.stackexchange.com/a/14119/59 – Kirk Kuykendall Sep 23 '14 at 13:34
  • I don't actually want to transform anything specific. I just want to tell ArcMap what transformations I want it to use for on the fly transformations in the map document. A cursory look at this interface makes me think it's not quite what I'm looking for. Although maybe a link in the chain... – cndnflyr Sep 23 '14 at 15:44
  • In arcobjects you can scan the list of predefined geotransformations and see which ones transform between the datum of the source data, and the datum of the dataframe. This is done with ISpatialReferenceFactory2.CreatePredefinedGeotransformations. I'm not sure how to access that from python though. – Kirk Kuykendall Sep 23 '14 at 16:01
  • Look at IMapGeographicTransformations – mkennedy Sep 23 '14 at 16:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.