<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Specify Geographic Transformation as user input in python script in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/specify-geographic-transformation-as-user-input-in/m-p/445243#M34864</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I &lt;/SPAN&gt;&lt;SPAN style="font-style:italic;"&gt;believe &lt;/SPAN&gt;&lt;SPAN&gt;you'd have to use ArcObjects to respond to such an event (choosing input/output datasets).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Edit: I think you can use a &lt;/SPAN&gt;&lt;A href="http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/Customizing_script_tool_behavior/00150000000t000000/"&gt;Tool Validator&lt;/A&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 27 Apr 2011 22:04:16 GMT</pubDate>
    <dc:creator>DarrenWiens2</dc:creator>
    <dc:date>2011-04-27T22:04:16Z</dc:date>
    <item>
      <title>Specify Geographic Transformation as user input in python script</title>
      <link>https://community.esri.com/t5/python-questions/specify-geographic-transformation-as-user-input-in/m-p/445242#M34863</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I have a script that includes the Project Raster process. The standard ArcToolbox tool dialog has an optional input to specify the Geographic Transformation. If it detects a datum transformation is needed between your input and output coordinate systems, it will automatically populate the drop-down list with relevant datum transformation options. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I would like to implement this type of parameter in my python script, but haven't been able to figure out how to go about it. The data type for this parameter is listed as "String" so I presume you could enter in the name for a transformation manually (i.e. "NAD_1927_To_NAD_1983_NADCON"), but it'd sure save a lot of trouble (who's going to remember the exact name?) if I could get the list to populate like on the standard tool.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Anyone ever do this successfully?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Many thanks!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Apr 2011 21:55:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/specify-geographic-transformation-as-user-input-in/m-p/445242#M34863</guid>
      <dc:creator>KarenMiller</dc:creator>
      <dc:date>2011-04-27T21:55:21Z</dc:date>
    </item>
    <item>
      <title>Re: Specify Geographic Transformation as user input in python script</title>
      <link>https://community.esri.com/t5/python-questions/specify-geographic-transformation-as-user-input-in/m-p/445243#M34864</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I &lt;/SPAN&gt;&lt;SPAN style="font-style:italic;"&gt;believe &lt;/SPAN&gt;&lt;SPAN&gt;you'd have to use ArcObjects to respond to such an event (choosing input/output datasets).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Edit: I think you can use a &lt;/SPAN&gt;&lt;A href="http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/Customizing_script_tool_behavior/00150000000t000000/"&gt;Tool Validator&lt;/A&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Apr 2011 22:04:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/specify-geographic-transformation-as-user-input-in/m-p/445243#M34864</guid>
      <dc:creator>DarrenWiens2</dc:creator>
      <dc:date>2011-04-27T22:04:16Z</dc:date>
    </item>
    <item>
      <title>Re: Specify Geographic Transformation as user input in python script</title>
      <link>https://community.esri.com/t5/python-questions/specify-geographic-transformation-as-user-input-in/m-p/445244#M34865</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I figured out the ones I use most often and set them as a system argument (variable) like this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;# Code 1515, United States 
if sys.argv[2] == "8483":
&amp;nbsp;&amp;nbsp;&amp;nbsp; print "Setting transformation method to: NAD_1983_To_WGS_1984_5"
&amp;nbsp;&amp;nbsp;&amp;nbsp; log.write("Setting transformation method to: NAD_1983_To_WGS_1984_5")
&amp;nbsp;&amp;nbsp;&amp;nbsp; transformation = "NAD_1983_To_WGS_1984_5"

# Code 1241, United States (contiguous 48 states)
if sys.argv[2] == "8327":
&amp;nbsp;&amp;nbsp;&amp;nbsp; print "Setting transformation method to: NAD_1927_To_NAD_1983_NADCON"
&amp;nbsp;&amp;nbsp;&amp;nbsp; log.write("Setting transformation method to: NAD_1927_To_NAD_1983_NADCON")
&amp;nbsp;&amp;nbsp;&amp;nbsp; transformation = "NAD_1927_To_NAD_1983_NADCON"
 
# Code 1901
if sys.argv[2] == "8483harn":
&amp;nbsp;&amp;nbsp;&amp;nbsp; print "Setting transformation method to: NAD_1983_HARN_To_WGS_1984_3"
&amp;nbsp;&amp;nbsp;&amp;nbsp; log.write("Setting transformation method to: NAD_1983_HARN_To_WGS_1984_3")
&amp;nbsp;&amp;nbsp;&amp;nbsp; transformation = "NAD_1983_HARN_To_WGS_1984_3"

# If you're not changing the datum...
if sys.argv[2] == "none":
&amp;nbsp;&amp;nbsp;&amp;nbsp; print "Setting transformation method to: none"
&amp;nbsp;&amp;nbsp;&amp;nbsp; log.write("Setting transformation method to: none")&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; transformation = ""

&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 19:54:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/specify-geographic-transformation-as-user-input-in/m-p/445244#M34865</guid>
      <dc:creator>RDHarles</dc:creator>
      <dc:date>2021-12-11T19:54:05Z</dc:date>
    </item>
    <item>
      <title>Re: Specify Geographic Transformation as user input in python script</title>
      <link>https://community.esri.com/t5/python-questions/specify-geographic-transformation-as-user-input-in/m-p/445245#M34866</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi guys,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; what you're trying to do here is non easy at 10.0.&amp;nbsp; We're working on some nice functions for the 10.1 release to do exactly what you're asking for.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This is still under development and subject to change... but here's what it should look like at 10.1.&amp;nbsp; Then you could put the tlist (below) into your script tool's params&lt;N&gt;.filter.list = tlist&lt;/N&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&amp;gt;&amp;gt;&amp;gt; from_sr = arcpy.SpatialReference('NAD 1983 HARN UTM Zone 11N')
&amp;gt;&amp;gt;&amp;gt; to_sr = arcpy.SpatialReference('NAD 1927 StatePlane California VI FIPS 0406')
&amp;gt;&amp;gt;&amp;gt; 
&amp;gt;&amp;gt;&amp;gt; # extent of San Diego county in from_sr coords
&amp;gt;&amp;gt;&amp;gt; ex = arcpy.Extent(444450.2212, 3599832.1877, 585727.9387, 3707930.3429)
&amp;gt;&amp;gt;&amp;gt; 
&amp;gt;&amp;gt;&amp;gt; tlist = arcpy.ListTransformations(from_sr, to_sr,ex)
&amp;gt;&amp;gt;&amp;gt; pprint.pprint(sorted(outlist))
[u'NAD_1983_HARN_PACP00_MARP00_To_WGS_1984 + NAD_1927_To_WGS_1984_18',
 u'NAD_1983_HARN_PACP00_MARP00_To_WGS_1984 + NAD_1927_To_WGS_1984_4',
 u'NAD_1983_HARN_PACP00_MARP00_To_WGS_1984 + NAD_1927_To_WGS_1984_6',
 u'NAD_1983_HARN_PACP00_MARP00_To_WGS_1984 + NAD_1927_To_WGS_1984_79_CONUS',
 u'NAD_1983_HARN_To_WGS_1984 + NAD_1927_To_WGS_1984_18',
 u'NAD_1983_HARN_To_WGS_1984 + NAD_1927_To_WGS_1984_4',
 u'NAD_1983_HARN_To_WGS_1984 + NAD_1927_To_WGS_1984_6',
 u'NAD_1983_HARN_To_WGS_1984 + NAD_1927_To_WGS_1984_79_CONUS',
 u'NAD_1983_HARN_To_WGS_1984_2 + NAD_1927_To_WGS_1984_18',
 u'NAD_1983_HARN_To_WGS_1984_2 + NAD_1927_To_WGS_1984_4',
 u'NAD_1983_HARN_To_WGS_1984_2 + NAD_1927_To_WGS_1984_6',
 u'NAD_1983_HARN_To_WGS_1984_2 + NAD_1927_To_WGS_1984_79_CONUS',
 u'NAD_1983_HARN_To_WGS_1984_3 + NAD_1927_To_WGS_1984_18',
 u'NAD_1983_HARN_To_WGS_1984_3 + NAD_1927_To_WGS_1984_4',
 u'NAD_1983_HARN_To_WGS_1984_3 + NAD_1927_To_WGS_1984_6',
 u'NAD_1983_HARN_To_WGS_1984_3 + NAD_1927_To_WGS_1984_79_CONUS',
 u'NAD_1983_To_HARN_CA_S + NAD_1927_To_NAD_1983_NADCON',
 u'WGS_1984_(ITRF00)_To_NAD_1983_HARN + NAD_1927_To_WGS_1984_18',
 u'WGS_1984_(ITRF00)_To_NAD_1983_HARN + NAD_1927_To_WGS_1984_4',
 u'WGS_1984_(ITRF00)_To_NAD_1983_HARN + NAD_1927_To_WGS_1984_6',
 u'WGS_1984_(ITRF00)_To_NAD_1983_HARN + NAD_1927_To_WGS_1984_79_CONUS']
&amp;gt;&amp;gt;&amp;gt; &lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 19:54:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/specify-geographic-transformation-as-user-input-in/m-p/445245#M34866</guid>
      <dc:creator>GhislainPrince</dc:creator>
      <dc:date>2021-12-11T19:54:08Z</dc:date>
    </item>
    <item>
      <title>Re: Specify Geographic Transformation as user input in python script</title>
      <link>https://community.esri.com/t5/python-questions/specify-geographic-transformation-as-user-input-in/m-p/445246#M34867</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Would using a &lt;/SPAN&gt;&lt;A href="http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/Customizing_script_tool_behavior/00150000000t000000/"&gt;Tool Validator &lt;/A&gt;&lt;SPAN&gt;work? I've never used one, but it seems like you could use it to populate your combobox.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Apr 2011 14:49:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/specify-geographic-transformation-as-user-input-in/m-p/445246#M34867</guid>
      <dc:creator>DarrenWiens2</dc:creator>
      <dc:date>2011-04-28T14:49:58Z</dc:date>
    </item>
    <item>
      <title>Re: Specify Geographic Transformation as user input in python script</title>
      <link>https://community.esri.com/t5/python-questions/specify-geographic-transformation-as-user-input-in/m-p/445247#M34868</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;The easiest way to do it would be to define a parameter (in your script tool parameters tab) that is of type String and has a Value Filter consisting of the names of the common transformations you listed. That way they appear as a dropdown that the user can pick from and the value chosen will be used as the input to your script.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;See &lt;/SPAN&gt;&lt;A href="http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/Setting_script_tool_parameters/00150000000n000000/"&gt;Setting script tool parameters&lt;/A&gt;&lt;SPAN&gt; in the help.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Otherwise I believe you would need to use ArcObjects to do something more intelligent such as listing only those transformations that apply between the two coordinate systems. The method Mr. Prince listed above would certainly make that easily doable within Python at 10.1.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Also, there is a link to a list of all the transformations on this page: &lt;/SPAN&gt;&lt;A href="http://resources.arcgis.com/content/kbase?fa=articleShow&amp;amp;d=21327"&gt;http://resources.arcgis.com/content/kbase?fa=articleShow&amp;amp;d=21327&lt;/A&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Apr 2011 15:40:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/specify-geographic-transformation-as-user-input-in/m-p/445247#M34868</guid>
      <dc:creator>LoganPugh</dc:creator>
      <dc:date>2011-04-28T15:40:27Z</dc:date>
    </item>
    <item>
      <title>Re: Specify Geographic Transformation as user input in python script</title>
      <link>https://community.esri.com/t5/python-questions/specify-geographic-transformation-as-user-input-in/m-p/445248#M34869</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks everyone for your responses! I had thought about using the tool validator, but it looks like you'd still have the problem intelligently populating the list. I agree, the easiest way would be to populate a value list filter with the most commonly used transformations - I simply was hoping I wouldn't have to guess what those will be in the future, in case something unusual comes up. And it looks like the improvements in 10.1 will do exactly what I want to do here. I suppose if one needs to use a transformation that isn't in my predefined list, they could just set it in the environment settings so it will run properly without crashing - that might be an acceptable work-around until 10.1 - whenever that is...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks again- I'll give this a try and see how it goes!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Apr 2011 15:56:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/specify-geographic-transformation-as-user-input-in/m-p/445248#M34869</guid>
      <dc:creator>KarenMiller</dc:creator>
      <dc:date>2011-04-28T15:56:02Z</dc:date>
    </item>
  </channel>
</rss>

