<?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 Using ArcPy Spatial Reference object as input to .net Geoprocessing Tool in ArcObjects SDK Questions</title>
    <link>https://community.esri.com/t5/arcobjects-sdk-questions/using-arcpy-spatial-reference-object-as-input-to/m-p/202721#M5267</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I am creating a custom .net geoprocessing tool. The ESRI geoprocessing tools accept Python &lt;/SPAN&gt;&lt;A href="http://resources.arcgis.com/en/help/main/10.1/index.html#//018z0000000v000000" rel="nofollow noopener noreferrer" target="_blank"&gt;SpatialReference&lt;/A&gt;&lt;SPAN&gt; Objects as input parameters for projection. How can this be achieved in a custom .net geoprocessing tool? I have tried specifying my parameter data type as both GPSpatialReferenceType and GPCoordinateSystemType and neither work, they give the error "Invalid value type for parameter out_projection" when used with a Python Spatial reference object. In order to use that object you have to call the exportToString() method which I would rather not do as it is not consistent with ESRI. There is no way to interecept the object and convert it to a string because within IGPFunction2.UpdateParameters the parameter value is null&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;Dim outputParameter As IGPParameterEdit3 = New GPParameterClass()
outputParameter.DataType = CType(New GPSpatialReferenceType(), IGPDataType)&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;David&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Dec 2021 10:04:35 GMT</pubDate>
    <dc:creator>DavidWilton</dc:creator>
    <dc:date>2021-12-11T10:04:35Z</dc:date>
    <item>
      <title>Using ArcPy Spatial Reference object as input to .net Geoprocessing Tool</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/using-arcpy-spatial-reference-object-as-input-to/m-p/202721#M5267</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I am creating a custom .net geoprocessing tool. The ESRI geoprocessing tools accept Python &lt;/SPAN&gt;&lt;A href="http://resources.arcgis.com/en/help/main/10.1/index.html#//018z0000000v000000" rel="nofollow noopener noreferrer" target="_blank"&gt;SpatialReference&lt;/A&gt;&lt;SPAN&gt; Objects as input parameters for projection. How can this be achieved in a custom .net geoprocessing tool? I have tried specifying my parameter data type as both GPSpatialReferenceType and GPCoordinateSystemType and neither work, they give the error "Invalid value type for parameter out_projection" when used with a Python Spatial reference object. In order to use that object you have to call the exportToString() method which I would rather not do as it is not consistent with ESRI. There is no way to interecept the object and convert it to a string because within IGPFunction2.UpdateParameters the parameter value is null&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;Dim outputParameter As IGPParameterEdit3 = New GPParameterClass()
outputParameter.DataType = CType(New GPSpatialReferenceType(), IGPDataType)&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;David&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 10:04:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/using-arcpy-spatial-reference-object-as-input-to/m-p/202721#M5267</guid>
      <dc:creator>DavidWilton</dc:creator>
      <dc:date>2021-12-11T10:04:35Z</dc:date>
    </item>
    <item>
      <title>Re: Using ArcPy Spatial Reference object as input to .net Geoprocessing Tool</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/using-arcpy-spatial-reference-object-as-input-to/m-p/202722#M5268</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I got a reply from ESRI support on this question so I'm posting for others. It is possible to have a python spatial reference as an input type. If you don't set the value of the output parameter it will only accept integers, string names, the spatial reference as a string or a string path of a prj file. However, setting the value allows you to pass in a python spatial reference object and the parameter will behave in exactly the same way as the ESRI ones (see project in data management for example)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;
&lt;P style="color: #000000; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px;"&gt;Dim outputParameter As IGPParameterEdit3 = New GPParameterClass()&lt;/P&gt;
&lt;P style="color: #000000; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px;"&gt;outputParameter = New GPParameterClass()&lt;/P&gt;
&lt;P style="color: #000000; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px;"&gt;outputParameter.DataType = DirectCast(New GPSpatialReferenceType(), IGPDataType)&lt;/P&gt;
&lt;P style="color: #000000; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px;"&gt;&lt;STRONG&gt;outputParameter.Value = DirectCast(New GPSpatialReferenceClass(), IGPValue)&lt;/STRONG&gt;&lt;/P&gt;
&lt;P style="color: #000000; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px;"&gt;outputParameter.Direction = esriGPParameterDirection.esriGPParameterDirectionInput&lt;/P&gt;
&lt;P style="color: #000000; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px;"&gt;outputParameter.DisplayName = "Output File Projection"&lt;/P&gt;
&lt;P style="color: #000000; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px;"&gt;outputParameter.Name = "out_projection"&lt;/P&gt;
&lt;P style="color: #000000; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px;"&gt;outputParameter.ParameterType = esriGPParameterType.esriGPParameterTypeRequired&lt;/P&gt;
&lt;P style="color: #000000; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px;"&gt;Dim pParameters As IArray = New ArrayClass()&lt;/P&gt;
&lt;P style="color: #000000; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px;"&gt;pParameters.Add(outputParameter)&lt;/P&gt;
&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BLOCKQUOTE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Jul 2014 00:16:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/using-arcpy-spatial-reference-object-as-input-to/m-p/202722#M5268</guid>
      <dc:creator>DavidWilton</dc:creator>
      <dc:date>2014-07-09T00:16:05Z</dc:date>
    </item>
  </channel>
</rss>

