<?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>idea Convert coordinate units using Python in ArcGIS Pro Ideas</title>
    <link>https://community.esri.com/t5/arcgis-pro-ideas/convert-coordinate-units-using-python/idi-p/970466</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;Add the ability to easily convert the units of XY coordinates using Python code.&amp;nbsp; For example, using Calculate Geometry tool, I can get the&amp;nbsp;coordinate&amp;nbsp;of a point&amp;nbsp;in meters, feet, decimal degrees, etc.&amp;nbsp; However, there's no easy way to do this in Python.&lt;BR /&gt;&lt;BR /&gt;The ability to convert units in code is available for areas and lengths.&amp;nbsp; For example, !shape.length@yards! will calculate the length of&amp;nbsp;a feature in yards.&amp;nbsp; What about adding a python function like !shape.extent.XMax@decimaldegrees! that will calculate the X coordinate of a point in decimal degrees?

&lt;!-- content transformation source ID: 087E00000004YOs --&gt;

&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 11 Mar 2013 16:35:56 GMT</pubDate>
    <dc:creator>LucasMurray2</dc:creator>
    <dc:date>2013-03-11T16:35:56Z</dc:date>
    <item>
      <title>Convert coordinate units using Python</title>
      <link>https://community.esri.com/t5/arcgis-pro-ideas/convert-coordinate-units-using-python/idi-p/970466</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;Add the ability to easily convert the units of XY coordinates using Python code.&amp;nbsp; For example, using Calculate Geometry tool, I can get the&amp;nbsp;coordinate&amp;nbsp;of a point&amp;nbsp;in meters, feet, decimal degrees, etc.&amp;nbsp; However, there's no easy way to do this in Python.&lt;BR /&gt;&lt;BR /&gt;The ability to convert units in code is available for areas and lengths.&amp;nbsp; For example, !shape.length@yards! will calculate the length of&amp;nbsp;a feature in yards.&amp;nbsp; What about adding a python function like !shape.extent.XMax@decimaldegrees! that will calculate the X coordinate of a point in decimal degrees?

&lt;!-- content transformation source ID: 087E00000004YOs --&gt;

&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Mar 2013 16:35:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-ideas/convert-coordinate-units-using-python/idi-p/970466</guid>
      <dc:creator>LucasMurray2</dc:creator>
      <dc:date>2013-03-11T16:35:56Z</dc:date>
    </item>
    <item>
      <title>Re: Convert coordinate units using Python</title>
      <link>https://community.esri.com/t5/arcgis-pro-ideas/convert-coordinate-units-using-python/idc-p/970467#M9123</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;It is not that simple because the x coordinate of a point in decimal degrees will be different if the point is in NAD27 vs NAD83. I think the best way to accomplish this is to use the projectAs method on the Geometry object passing in a new spatial reference and appropriate geographic transformation. This will return a new Geometry object and then you can access the X and Y coordinates of the point in the new spatial reference.

&lt;!-- content transformation source ID: 00aE000000295xa --&gt;

&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Mar 2013 18:41:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-ideas/convert-coordinate-units-using-python/idc-p/970467#M9123</guid>
      <dc:creator>ChrisFox</dc:creator>
      <dc:date>2013-03-11T18:41:23Z</dc:date>
    </item>
    <item>
      <title>Re: Convert coordinate units using Python</title>
      <link>https://community.esri.com/t5/arcgis-pro-ideas/convert-coordinate-units-using-python/idc-p/970468#M9124</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;Chris, I investigated your proposed solution, and it works provided you are working with only geographic coordinate systems. However, working with UTM or MGRS really does not faciliate this.&lt;BR /&gt;&lt;BR /&gt;To relate this solution to be more aligned to existing functinality, all we need is a tool doing the exact same thing as the Convert Coordinate Notation tool, except not requiring a table to be created first.&amp;nbsp;If a method were provided with the same parameters, except the input and output were not a table and feature class, but simply an input set of coordinates and output set of coordinates, this would be ideal.&lt;BR /&gt;&lt;BR /&gt;Right now, to convert in a tool, I have to create an in_memory table with the input coordinates, use the convert coordinate notation tool to convert to another in_memory feature class and extract the SHAPE@X and SHAPE@Y attributes to get what I need. This is a huge amount of overhead for something so simple. A simple method very similar to the functionality provided by the convert coordinate notation tool, except not requiring complete datasets...this is what is needed.

&lt;!-- content transformation source ID: 00aE0000002zRCW --&gt;

&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 11 Jun 2013 19:40:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-ideas/convert-coordinate-units-using-python/idc-p/970468#M9124</guid>
      <dc:creator>JoelMcCune1</dc:creator>
      <dc:date>2013-06-11T19:40:21Z</dc:date>
    </item>
    <item>
      <title>Re: Convert coordinate units using Python</title>
      <link>https://community.esri.com/t5/arcgis-pro-ideas/convert-coordinate-units-using-python/idc-p/970469#M9125</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;...yeah but, in the calculate geometry tool you're allowed to enter the Coordinate System to calculate on...&lt;BR /&gt;&lt;BR /&gt;&lt;IMG alt="0EME0000000Tk5U" __migration_original_url="https://c.na9.content.force.com/servlet/rtaImage?eid=00aE0000005VBba&amp;amp;feoid=CommentBody&amp;amp;refid=0EME0000000Tk5U" __migration_image_ext="0EME0000000Tk5U" class="jive-image" src="https://community.esri.com/legacyfs/online/203463_0EME0000000Tk5U" /&gt;

&lt;!-- content transformation source ID: 00aE0000005VBba --&gt;

&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Feb 2014 18:32:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-ideas/convert-coordinate-units-using-python/idc-p/970469#M9125</guid>
      <dc:creator>JimPhilippi1</dc:creator>
      <dc:date>2014-02-18T18:32:15Z</dc:date>
    </item>
    <item>
      <title>Re: Convert coordinate units using Python - Status changed to: Implemented</title>
      <link>https://community.esri.com/t5/arcgis-pro-ideas/convert-coordinate-units-using-python/idc-p/1183996#M19944</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;Thank you for your suggestions on this! I'm happy to report that this has since been&amp;nbsp;been implemented with the &lt;FONT face="courier new,courier"&gt;PointGeometry.toCoordString(&amp;lt;notation&amp;gt;)&lt;/FONT&gt;&amp;nbsp;method, see&amp;nbsp;&lt;A href="https://pro.arcgis.com/en/pro-app/2.6/arcpy/classes/pointgeometry.htm" target="_blank"&gt;https://pro.arcgis.com/en/pro-app/2.6/arcpy/classes/pointgeometry.htm&lt;/A&gt;.&amp;nbsp;&lt;/P&gt;&lt;P&gt;The coordinate string can be turned back into a PointGeometry with the&amp;nbsp;&lt;FONT face="courier new,courier"&gt;arcpy.fromCoordString(&amp;lt;string&amp;gt;, &amp;lt;notation&amp;gt;)&lt;/FONT&gt; function.&lt;/P&gt;&lt;P&gt;For example:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;# Create a point in WGS84
point_wgs = arcpy.PointGeometry(
arcpy.Point(-93.109591203, 42.724789892),
arcpy.SpatialReference(4326)
)

# Check result
print(point_wgs.spatialReference.factoryCode)
print(point_wgs[0])

# Get the coordinates in UTM
utm_coords = point_wgs.toCoordString("UTM")

# Create a new point from UTM coordinates
point_utm = arcpy.FromCoordString(utm_coords, "UTM")

# Check result (note, FromCoordString output always in WGS84)
print(point_utm.spatialReference.factoryCode)
print(point_utm[0])&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 17 Jun 2022 18:28:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-ideas/convert-coordinate-units-using-python/idc-p/1183996#M19944</guid>
      <dc:creator>HannesZiegler</dc:creator>
      <dc:date>2022-06-17T18:28:23Z</dc:date>
    </item>
  </channel>
</rss>

