<?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 Reprojecting an Extent object in a Python Toolbox in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/reprojecting-an-extent-object-in-a-python-toolbox/m-p/1570075#M73391</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I am wondering how to reproject an arcpy.Extent object. I have a Python script toolboxes with a single GPExtent parameter. In the execute block, I have the following code:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;ext = parameters[0].value 
srs = arcpy.SpatialReference(4326) 
ext.projectAs(srs)&lt;/LI-CODE&gt;&lt;P&gt;When I run this, I get an error stating "RuntimeError: Object: CreateObject error creating spatial reference". Am I doing something wrong? Oddly, the above code runs fine in a notebook.&lt;/P&gt;&lt;P&gt;Thanks in advance!&lt;/P&gt;</description>
    <pubDate>Thu, 19 Dec 2024 03:34:11 GMT</pubDate>
    <dc:creator>LewisTrotter</dc:creator>
    <dc:date>2024-12-19T03:34:11Z</dc:date>
    <item>
      <title>Reprojecting an Extent object in a Python Toolbox</title>
      <link>https://community.esri.com/t5/python-questions/reprojecting-an-extent-object-in-a-python-toolbox/m-p/1570075#M73391</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I am wondering how to reproject an arcpy.Extent object. I have a Python script toolboxes with a single GPExtent parameter. In the execute block, I have the following code:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;ext = parameters[0].value 
srs = arcpy.SpatialReference(4326) 
ext.projectAs(srs)&lt;/LI-CODE&gt;&lt;P&gt;When I run this, I get an error stating "RuntimeError: Object: CreateObject error creating spatial reference". Am I doing something wrong? Oddly, the above code runs fine in a notebook.&lt;/P&gt;&lt;P&gt;Thanks in advance!&lt;/P&gt;</description>
      <pubDate>Thu, 19 Dec 2024 03:34:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/reprojecting-an-extent-object-in-a-python-toolbox/m-p/1570075#M73391</guid>
      <dc:creator>LewisTrotter</dc:creator>
      <dc:date>2024-12-19T03:34:11Z</dc:date>
    </item>
    <item>
      <title>Re: Reprojecting an Extent object in a Python Toolbox</title>
      <link>https://community.esri.com/t5/python-questions/reprojecting-an-extent-object-in-a-python-toolbox/m-p/1570109#M73392</link>
      <description>&lt;P&gt;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/arcpy/classes/extent.htm" target="_blank"&gt;Extent—ArcGIS Pro | Documentation&lt;/A&gt;&lt;/P&gt;&lt;P&gt;What is parameter 0?&amp;nbsp; use an AddMessage to report it.&amp;nbsp; Perhaps the extent object is non-existent or not in the correct form&lt;/P&gt;</description>
      <pubDate>Thu, 19 Dec 2024 10:20:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/reprojecting-an-extent-object-in-a-python-toolbox/m-p/1570109#M73392</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2024-12-19T10:20:50Z</dc:date>
    </item>
    <item>
      <title>Re: Reprojecting an Extent object in a Python Toolbox</title>
      <link>https://community.esri.com/t5/python-questions/reprojecting-an-extent-object-in-a-python-toolbox/m-p/1570494#M73400</link>
      <description>&lt;P&gt;Thanks Dan,&lt;/P&gt;&lt;P&gt;It is an Extent object, I can pluck the XMin, XMax et al. from it no problem. It also appears to have the correct .spatialReference.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 20 Dec 2024 03:40:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/reprojecting-an-extent-object-in-a-python-toolbox/m-p/1570494#M73400</guid>
      <dc:creator>LewisTrotter</dc:creator>
      <dc:date>2024-12-20T03:40:46Z</dc:date>
    </item>
    <item>
      <title>Re: Reprojecting an Extent object in a Python Toolbox</title>
      <link>https://community.esri.com/t5/python-questions/reprojecting-an-extent-object-in-a-python-toolbox/m-p/1570495#M73401</link>
      <description>&lt;P&gt;You might want to have a look at this link&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.esri.com/t5/python-questions/python-extent-calculations/m-p/1090393/highlight/true#M62117" target="_blank"&gt;Python Extent Calculations&lt;/A&gt;&lt;/P&gt;&lt;P&gt;it uses the extent object to make a geometry object, project it, then get the extent... seems to contradict the projectAs in the help though if the source and destination spatial references are known and correct&lt;/P&gt;</description>
      <pubDate>Fri, 20 Dec 2024 04:25:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/reprojecting-an-extent-object-in-a-python-toolbox/m-p/1570495#M73401</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2024-12-20T04:25:08Z</dc:date>
    </item>
    <item>
      <title>Re: Reprojecting an Extent object in a Python Toolbox</title>
      <link>https://community.esri.com/t5/python-questions/reprojecting-an-extent-object-in-a-python-toolbox/m-p/1570577#M73407</link>
      <description>&lt;P&gt;You might need to assign a transformation, according to the docstring for Extent.projectAs():&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="HaydenWelch_0-1734704026606.png" style="width: 787px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/122236iD8E54B9619747830/image-dimensions/787x303?v=v2" width="787" height="303" role="button" title="HaydenWelch_0-1734704026606.png" alt="HaydenWelch_0-1734704026606.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;If your projection requires a transformation, you can use&amp;nbsp;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/arcpy/functions/listtransformations.htm" target="_self"&gt;ListTransformations&lt;/A&gt;&amp;nbsp; to get a list of valid transformations and pass those to the call:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;from arcpy import Extent, SpatialReference, ListTransformations

ext: Extent = parameters[0].value 
srs = SpatialReference(4326)

transformation: str = ListTransformations(ext.spatialReference, srs, extent=ext)[0]

ext.projectAs(srs, transformation_name=transformation)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 20 Dec 2024 14:20:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/reprojecting-an-extent-object-in-a-python-toolbox/m-p/1570577#M73407</guid>
      <dc:creator>HaydenWelch</dc:creator>
      <dc:date>2024-12-20T14:20:45Z</dc:date>
    </item>
    <item>
      <title>Re: Reprojecting an Extent object in a Python Toolbox</title>
      <link>https://community.esri.com/t5/python-questions/reprojecting-an-extent-object-in-a-python-toolbox/m-p/1620482#M74317</link>
      <description>&lt;P&gt;Thanks! I ran into the same issue recently, and converting the extent to a geometry fixed it. Seems to be a python toolbox bug, because the Extent projectAs() works fine from a python shell. Never would've figured that out...&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 03 Jun 2025 16:03:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/reprojecting-an-extent-object-in-a-python-toolbox/m-p/1620482#M74317</guid>
      <dc:creator>KristinBlier</dc:creator>
      <dc:date>2025-06-03T16:03:58Z</dc:date>
    </item>
  </channel>
</rss>

