<?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 Getting a spatial reference from a script tool parameter in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/getting-a-spatial-reference-from-a-script-tool/m-p/141703#M10997</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Been stuck on this for a while this afternoon.&lt;/P&gt;&lt;P&gt;I have been writing a script tool which loads some data from a table in a db.&lt;/P&gt;&lt;P&gt;I needed to then set the spatial reference of the coordinates.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So, in my script I had :&lt;/P&gt;&lt;P&gt;SR = arcpy.GetParameterAsText(1)&lt;/P&gt;&lt;P&gt;And in the tool properties, this is set to a Coordinate System data type. So you get the nice pull down list of the available coordinate systems.&lt;/P&gt;&lt;P&gt;However, this returns a text representation of the prj, not a spatial reference object.&lt;/P&gt;&lt;P&gt;Then I tried to do this :&lt;/P&gt;&lt;P&gt;SR = arcpy.SpatialReference(arcpy.GetParameterAsText(1))&lt;/P&gt;&lt;P&gt;But you get an error because SR objects can only be created using :&lt;/P&gt;&lt;P&gt;1. Get them from a describe object&lt;/P&gt;&lt;P&gt;2. The WKID of the SR&lt;/P&gt;&lt;P&gt;3. A path to a projection file.&lt;/P&gt;&lt;P&gt;You cannot use a text string.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The answer turned out to be :&lt;/P&gt;&lt;P&gt;SRtxt = arcpy.GetParameterAsText(1)&lt;/P&gt;&lt;P&gt;SR = arcpy.SpatialReference()&amp;nbsp; # an empty spatial reference object&lt;/P&gt;&lt;P&gt;SR.loadFromString(SRtxt)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Phew....&lt;/P&gt;&lt;P&gt;Now on with the rest of it....&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 10 Mar 2015 14:00:46 GMT</pubDate>
    <dc:creator>NeilAyres</dc:creator>
    <dc:date>2015-03-10T14:00:46Z</dc:date>
    <item>
      <title>Getting a spatial reference from a script tool parameter</title>
      <link>https://community.esri.com/t5/python-questions/getting-a-spatial-reference-from-a-script-tool/m-p/141703#M10997</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Been stuck on this for a while this afternoon.&lt;/P&gt;&lt;P&gt;I have been writing a script tool which loads some data from a table in a db.&lt;/P&gt;&lt;P&gt;I needed to then set the spatial reference of the coordinates.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So, in my script I had :&lt;/P&gt;&lt;P&gt;SR = arcpy.GetParameterAsText(1)&lt;/P&gt;&lt;P&gt;And in the tool properties, this is set to a Coordinate System data type. So you get the nice pull down list of the available coordinate systems.&lt;/P&gt;&lt;P&gt;However, this returns a text representation of the prj, not a spatial reference object.&lt;/P&gt;&lt;P&gt;Then I tried to do this :&lt;/P&gt;&lt;P&gt;SR = arcpy.SpatialReference(arcpy.GetParameterAsText(1))&lt;/P&gt;&lt;P&gt;But you get an error because SR objects can only be created using :&lt;/P&gt;&lt;P&gt;1. Get them from a describe object&lt;/P&gt;&lt;P&gt;2. The WKID of the SR&lt;/P&gt;&lt;P&gt;3. A path to a projection file.&lt;/P&gt;&lt;P&gt;You cannot use a text string.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The answer turned out to be :&lt;/P&gt;&lt;P&gt;SRtxt = arcpy.GetParameterAsText(1)&lt;/P&gt;&lt;P&gt;SR = arcpy.SpatialReference()&amp;nbsp; # an empty spatial reference object&lt;/P&gt;&lt;P&gt;SR.loadFromString(SRtxt)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Phew....&lt;/P&gt;&lt;P&gt;Now on with the rest of it....&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Mar 2015 14:00:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/getting-a-spatial-reference-from-a-script-tool/m-p/141703#M10997</guid>
      <dc:creator>NeilAyres</dc:creator>
      <dc:date>2015-03-10T14:00:46Z</dc:date>
    </item>
    <item>
      <title>Re: Getting a spatial reference from a script tool parameter</title>
      <link>https://community.esri.com/t5/python-questions/getting-a-spatial-reference-from-a-script-tool/m-p/141704#M10998</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Interesting little tidbit. Thanks for sharing.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Mar 2015 16:40:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/getting-a-spatial-reference-from-a-script-tool/m-p/141704#M10998</guid>
      <dc:creator>BlakeTerhune</dc:creator>
      <dc:date>2015-03-10T16:40:26Z</dc:date>
    </item>
    <item>
      <title>Re: Getting a spatial reference from a script tool parameter</title>
      <link>https://community.esri.com/t5/python-questions/getting-a-spatial-reference-from-a-script-tool/m-p/141705#M10999</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Did you try arcpy.GetParameter(1) instead of GetParameterAsText? GetParameter returns the parameter as an object instead of a string. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Mar 2015 19:30:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/getting-a-spatial-reference-from-a-script-tool/m-p/141705#M10999</guid>
      <dc:creator>Luke_Pinner</dc:creator>
      <dc:date>2015-03-10T19:30:12Z</dc:date>
    </item>
    <item>
      <title>Re: Getting a spatial reference from a script tool parameter</title>
      <link>https://community.esri.com/t5/python-questions/getting-a-spatial-reference-from-a-script-tool/m-p/141706#M11000</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I did try GetParameter, same result, it doesn't return a SR object, but a string!&lt;/P&gt;&lt;P&gt;I looked and looked through the documentation and found no pointers how to do this.&lt;/P&gt;&lt;P&gt;If the esri folk are listening, perhaps something should be in in the help files on how to do this.&lt;/P&gt;&lt;P&gt;My solution works, but is there another way to do it?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Mar 2015 05:32:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/getting-a-spatial-reference-from-a-script-tool/m-p/141706#M11000</guid>
      <dc:creator>NeilAyres</dc:creator>
      <dc:date>2015-03-11T05:32:33Z</dc:date>
    </item>
    <item>
      <title>Re: Getting a spatial reference from a script tool parameter</title>
      <link>https://community.esri.com/t5/python-questions/getting-a-spatial-reference-from-a-script-tool/m-p/141707#M11001</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Oh, and another thing...&lt;/P&gt;&lt;P&gt;How do you get the advanced editor when starting a new thread so that you can do the code formatting correctly?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Mar 2015 05:36:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/getting-a-spatial-reference-from-a-script-tool/m-p/141707#M11001</guid>
      <dc:creator>NeilAyres</dc:creator>
      <dc:date>2015-03-11T05:36:25Z</dc:date>
    </item>
    <item>
      <title>Re: Getting a spatial reference from a script tool parameter</title>
      <link>https://community.esri.com/t5/python-questions/getting-a-spatial-reference-from-a-script-tool/m-p/141708#M11002</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you start a new discussion you should already be in the advanced editor. &lt;/P&gt;&lt;P&gt;&lt;IMG alt="advancededitor.png" class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/72228_advancededitor.png" style="width: 620px; height: 362px;" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Mar 2015 05:41:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/getting-a-spatial-reference-from-a-script-tool/m-p/141708#M11002</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2015-03-11T05:41:33Z</dc:date>
    </item>
    <item>
      <title>Re: Getting a spatial reference from a script tool parameter</title>
      <link>https://community.esri.com/t5/python-questions/getting-a-spatial-reference-from-a-script-tool/m-p/141709#M11003</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;... with respect to the coordinate system, remember that coordinate system and spatial reference are not the same. Look at the following tool, where a coordinate system and a spatial reference can be specified (both using the same interface!):&lt;/P&gt;&lt;P&gt;&lt;IMG alt="crdsys_sr.png" class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/72229_crdsys_sr.png" style="height: auto;" /&gt;&lt;/P&gt;&lt;P&gt;If the script for this tool is:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy
crdsys_astext = arcpy.GetParameterAsText(0)
crdsys_assobject = arcpy.GetParameter(0)
sr_astext = arcpy.GetParameterAsText(1)
sr_assobject = arcpy.GetParameter(1)

arcpy.AddMessage("crdsys_astext&amp;nbsp; : {0}".format(crdsys_astext))
arcpy.AddMessage("crdsys_asobject: {0}".format(crdsys_assobject))
arcpy.AddMessage("sr_astext&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; : {0}".format(sr_astext))
arcpy.AddMessage("sr_asobject&amp;nbsp;&amp;nbsp;&amp;nbsp; : {0}".format(sr_assobject))&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;then this would output:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;Start Time: Tue Mar 10 22:55:26 2015&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;Running script Script...&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;crdsys_astext&amp;nbsp; : PROJCS['RD_New',GEOGCS['GCS_Amersfoort',DATUM['D_Amersfoort',SPHEROID[' ... etc&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;crdsys_asobject: PROJCS['RD_New',GEOGCS['GCS_Amersfoort',DATUM['D_Amersfoort',SPHEROID[' ... etc&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;sr_astext&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; : PROJCS['RD_New',GEOGCS['GCS_Amersfoort',DATUM['D_Amersfoort',SPHEROID[' ... etc&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; color: #7ed529;"&gt;sr_asobject&amp;nbsp;&amp;nbsp;&amp;nbsp; : &amp;lt;geoprocessing spatial reference object object at 0x181E6E78&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;Completed script Script...&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So, to get the sr object, you should define the parameter as spatial reference and read it as object, not as text.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 07:48:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/getting-a-spatial-reference-from-a-script-tool/m-p/141709#M11003</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2021-12-11T07:48:17Z</dc:date>
    </item>
    <item>
      <title>Re: Getting a spatial reference from a script tool parameter</title>
      <link>https://community.esri.com/t5/python-questions/getting-a-spatial-reference-from-a-script-tool/m-p/141710#M11004</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Xander,&lt;/P&gt;&lt;P&gt;see this..&lt;/P&gt;&lt;P&gt;My code&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;# test spatial reference
import sys, os
import arcpy
SR = arcpy.SpatialReference(arcpy.GetParameter(0))
msg = "Coord sys is {}".format(SR.name)
print msg
arcpy.AddMessage(msg)&lt;/PRE&gt;&lt;P&gt;&lt;IMG alt="TestCoordSys.jpg" class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/72326_TestCoordSys.jpg" style="width: 620px; height: 438px;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="TestCoordSys_ToolParameters.jpg" class="image-2 jive-image" src="https://community.esri.com/legacyfs/online/72327_TestCoordSys_ToolParameters.jpg" style="height: auto;" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 07:48:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/getting-a-spatial-reference-from-a-script-tool/m-p/141710#M11004</guid>
      <dc:creator>NeilAyres</dc:creator>
      <dc:date>2021-12-11T07:48:19Z</dc:date>
    </item>
    <item>
      <title>Re: Getting a spatial reference from a script tool parameter</title>
      <link>https://community.esri.com/t5/python-questions/getting-a-spatial-reference-from-a-script-tool/m-p/141711#M11005</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;... and if you change the definition of the parameter type to spatial reference (instead of coordinate system)?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Mar 2015 06:16:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/getting-a-spatial-reference-from-a-script-tool/m-p/141711#M11005</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2015-03-11T06:16:44Z</dc:date>
    </item>
    <item>
      <title>Re: Getting a spatial reference from a script tool parameter</title>
      <link>https://community.esri.com/t5/python-questions/getting-a-spatial-reference-from-a-script-tool/m-p/141712#M11006</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Did that, still doesn't work.&lt;/P&gt;&lt;P&gt;If you look at your code above, you are printing the contents of the variable.&lt;/P&gt;&lt;P&gt;Its still not an SR object.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Mar 2015 09:24:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/getting-a-spatial-reference-from-a-script-tool/m-p/141712#M11006</guid>
      <dc:creator>NeilAyres</dc:creator>
      <dc:date>2015-03-11T09:24:10Z</dc:date>
    </item>
    <item>
      <title>Re: Getting a spatial reference from a script tool parameter</title>
      <link>https://community.esri.com/t5/python-questions/getting-a-spatial-reference-from-a-script-tool/m-p/141713#M11007</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Get parameter should work,&lt;/P&gt;&lt;P&gt;Try your procedure from the command line, which necessitates reading from an input file&lt;/P&gt;&lt;P&gt;And to get the advanced syntax, you have to click on the title of the thread and go to the actual thread itself and NOT reply from your inbox...at least in IE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&amp;gt;&amp;gt;&amp;gt; import arcpy
&amp;gt;&amp;gt;&amp;gt; input_shp = 'c:/!Scripts/Shapefiles/AOI_mtm9.shp'
&amp;gt;&amp;gt;&amp;gt; desc = arcpy.Describe(input_shp)
&amp;gt;&amp;gt;&amp;gt; SR = desc.spatialReference
&amp;gt;&amp;gt;&amp;gt; SR
&amp;lt;geoprocessing spatial reference object object at 0x089330E0&amp;gt;
&amp;gt;&amp;gt;&amp;gt; SR_PCSCode = SR.PCSCode
&amp;gt;&amp;gt;&amp;gt; print('Spatial Reference {}'.format(SR.name))
Spatial Reference NAD_1983_CSRS_MTM_9
&amp;gt;&amp;gt;&amp;gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 07:48:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/getting-a-spatial-reference-from-a-script-tool/m-p/141713#M11007</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2021-12-11T07:48:22Z</dc:date>
    </item>
    <item>
      <title>Re: Getting a spatial reference from a script tool parameter</title>
      <link>https://community.esri.com/t5/python-questions/getting-a-spatial-reference-from-a-script-tool/m-p/141714#M11008</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dan,&lt;/P&gt;&lt;P&gt;I know I can get a SR object from a describe of a feature.&lt;/P&gt;&lt;P&gt;The point here is to set a SR from a script tool parameter.&lt;/P&gt;&lt;P&gt;It seems the way to do it is as outlined in my first post.&lt;/P&gt;&lt;P&gt;But I am very open to alternative suggestions.&lt;/P&gt;&lt;P&gt;Perhaps someone from esri could advise how this is done, and put something in the help files to illustrate this.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Mar 2015 11:40:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/getting-a-spatial-reference-from-a-script-tool/m-p/141714#M11008</guid>
      <dc:creator>NeilAyres</dc:creator>
      <dc:date>2015-03-11T11:40:58Z</dc:date>
    </item>
    <item>
      <title>Re: Getting a spatial reference from a script tool parameter</title>
      <link>https://community.esri.com/t5/python-questions/getting-a-spatial-reference-from-a-script-tool/m-p/141715#M11009</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;OK, let's make it more visual. I change the code to:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy
crdsys_astext = arcpy.GetParameterAsText(0)
crdsys_assobject = arcpy.GetParameter(0)
sr_astext = arcpy.GetParameterAsText(1)
sr_assobject = arcpy.GetParameter(1)

if hasattr(crdsys_astext, "name"):
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddMessage("crdsys_astext.name&amp;nbsp; : {0}".format(crdsys_astext.name))
if hasattr(crdsys_assobject, "name"):
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddMessage("crdsys_asobject.name: {0}".format(crdsys_assobject.name))
if hasattr(sr_astext, "name"):
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddMessage("sr_astext.name&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; : {0}".format(sr_astext.name))
if hasattr(sr_assobject, "name"):
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddMessage("sr_asobject.name&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; : {0}".format(sr_assobject.name))
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddMessage("sr_asobject.factoryCode: {0}".format(sr_assobject.factoryCode))&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The result being:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;Start Time: Wed Mar 11 08:39:03 2015
Running script Script...
sr_asobject.name&amp;nbsp;&amp;nbsp;&amp;nbsp; : RD_New
Completed script Script...
Succeeded at Wed Mar 11 08:39:03 2015 (Elapsed Time: 0,07 seconds)&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So, the only correct and intended way of doing this is using a spatial reference parameter type and reading it as an object. BTW, I'm using 10.2.2 for this demo code. What version are you using?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 07:48:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/getting-a-spatial-reference-from-a-script-tool/m-p/141715#M11009</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2021-12-11T07:48:24Z</dc:date>
    </item>
    <item>
      <title>Re: Getting a spatial reference from a script tool parameter</title>
      <link>https://community.esri.com/t5/python-questions/getting-a-spatial-reference-from-a-script-tool/m-p/141716#M11010</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Xander,&lt;/P&gt;&lt;P&gt;okay, I see what you are doing.&lt;/P&gt;&lt;P&gt;And, yes, if I set the Data Type to Spatial Reference &amp;amp; use GetParameter&lt;/P&gt;&lt;P&gt;There is no need to use arcpy.SpatialReference on the input variable, because it already is a SR object.&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;using v10.2.2&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Mar 2015 14:04:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/getting-a-spatial-reference-from-a-script-tool/m-p/141716#M11010</guid>
      <dc:creator>NeilAyres</dc:creator>
      <dc:date>2015-03-12T14:04:21Z</dc:date>
    </item>
  </channel>
</rss>

