<?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: Tool to display Lat/Long of vertice in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/tool-to-display-lat-long-of-vertice/m-p/727442#M56405</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;With AML one could project a text file, which was handy.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;However, with arcpy, one can:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;identfy the wanted point &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;use a search cursor to grab the shape object&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;create a PointGeometry object from the point object and the fc spatial reference&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;make an in-memory FC with the Point Geometry object&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;project the in-mem fc (you have to project to an on-disc output fc)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;use another search cursor to grab the (projected) point object&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;pull out its component X and Y positions&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This snippit is part of a larger routine, and gets the Lat Long location of a polygon centroid, but it's the same idea...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
descObj = arcpy.Describe(inFeatures)
shapeName = descObj.shapeFieldName
spatialRef = descObj.spatialReference
pointGeometryList = []

###&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; finds polygon centroid in projected meters
rows = arcpy.SearchCursor(inFeatures)
for row in rows:
&amp;nbsp;&amp;nbsp;&amp;nbsp; polyCent = row.getValue(shapeName).centroid
&amp;nbsp;&amp;nbsp;&amp;nbsp; pointGeometry = arcpy.PointGeometry(polyCent, spatialRef)
&amp;nbsp;&amp;nbsp;&amp;nbsp; pointGeometryList.append(pointGeometry)&amp;nbsp;&amp;nbsp; 
del rows

###&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; creates in memory point feature
if arcpy.Exists(outFeatures): arcpy.Delete_management(outFeatures)
arcpy.CopyFeatures_management(pointGeometryList, outFeatures)

###&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; projects centoid to WGS84 (must write to FeatClass)
if arcpy.Exists(ddFeatures): arcpy.Delete_management(ddFeatures)
arcpy.Project_management(outFeatures, ddFeatures, ddPrj)

###&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; find centroid in decimal degrees
descObj = arcpy.Describe(ddFeatures)
shapeName = descObj.shapeFieldName
rows = arcpy.SearchCursor(ddFeatures)
for row in rows:
&amp;nbsp;&amp;nbsp;&amp;nbsp; longitude = row.getValue(shapeName).centroid.X
&amp;nbsp;&amp;nbsp;&amp;nbsp; latitude = row.getValue(shapeName).centroid.Y
print str(longitude)
print str(latitude)
del rows
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 12 Dec 2021 07:06:34 GMT</pubDate>
    <dc:creator>markdenil</dc:creator>
    <dc:date>2021-12-12T07:06:34Z</dc:date>
    <item>
      <title>Tool to display Lat/Long of vertice</title>
      <link>https://community.esri.com/t5/python-questions/tool-to-display-lat-long-of-vertice/m-p/727441#M56404</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;We are in the process of moving our County Section Maps from Coverage to GDB. Years ago, when my coworkers were creating these maps in WorkStation, my boss wrote an AML to identify the latitude/longitude of a given node. The nodes did not have a lat/long stored, so the AML took the county grid X,Y and projects it, and spits out the latitude and longitude. I'm not sure why he needs this, and I honestly don't have experience with python or scripts, but I've been tasked to find or create a tool to do this. Any help or reference materials is greatly appreciated.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Note: I have found that the edit sketch properties window will give me X/Y county grid coordinates of the vertices of a selected arc, but can't find a setting to change it to LAT/LONG coordinates.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 Feb 2012 20:21:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/tool-to-display-lat-long-of-vertice/m-p/727441#M56404</guid>
      <dc:creator>MikeMatthews</dc:creator>
      <dc:date>2012-02-06T20:21:03Z</dc:date>
    </item>
    <item>
      <title>Re: Tool to display Lat/Long of vertice</title>
      <link>https://community.esri.com/t5/python-questions/tool-to-display-lat-long-of-vertice/m-p/727442#M56405</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;With AML one could project a text file, which was handy.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;However, with arcpy, one can:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;identfy the wanted point &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;use a search cursor to grab the shape object&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;create a PointGeometry object from the point object and the fc spatial reference&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;make an in-memory FC with the Point Geometry object&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;project the in-mem fc (you have to project to an on-disc output fc)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;use another search cursor to grab the (projected) point object&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;pull out its component X and Y positions&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This snippit is part of a larger routine, and gets the Lat Long location of a polygon centroid, but it's the same idea...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
descObj = arcpy.Describe(inFeatures)
shapeName = descObj.shapeFieldName
spatialRef = descObj.spatialReference
pointGeometryList = []

###&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; finds polygon centroid in projected meters
rows = arcpy.SearchCursor(inFeatures)
for row in rows:
&amp;nbsp;&amp;nbsp;&amp;nbsp; polyCent = row.getValue(shapeName).centroid
&amp;nbsp;&amp;nbsp;&amp;nbsp; pointGeometry = arcpy.PointGeometry(polyCent, spatialRef)
&amp;nbsp;&amp;nbsp;&amp;nbsp; pointGeometryList.append(pointGeometry)&amp;nbsp;&amp;nbsp; 
del rows

###&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; creates in memory point feature
if arcpy.Exists(outFeatures): arcpy.Delete_management(outFeatures)
arcpy.CopyFeatures_management(pointGeometryList, outFeatures)

###&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; projects centoid to WGS84 (must write to FeatClass)
if arcpy.Exists(ddFeatures): arcpy.Delete_management(ddFeatures)
arcpy.Project_management(outFeatures, ddFeatures, ddPrj)

###&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; find centroid in decimal degrees
descObj = arcpy.Describe(ddFeatures)
shapeName = descObj.shapeFieldName
rows = arcpy.SearchCursor(ddFeatures)
for row in rows:
&amp;nbsp;&amp;nbsp;&amp;nbsp; longitude = row.getValue(shapeName).centroid.X
&amp;nbsp;&amp;nbsp;&amp;nbsp; latitude = row.getValue(shapeName).centroid.Y
print str(longitude)
print str(latitude)
del rows
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 07:06:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/tool-to-display-lat-long-of-vertice/m-p/727442#M56405</guid>
      <dc:creator>markdenil</dc:creator>
      <dc:date>2021-12-12T07:06:34Z</dc:date>
    </item>
    <item>
      <title>Re: Tool to display Lat/Long of vertice</title>
      <link>https://community.esri.com/t5/python-questions/tool-to-display-lat-long-of-vertice/m-p/727443#M56406</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Very good. Thank you sir.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Feb 2012 17:33:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/tool-to-display-lat-long-of-vertice/m-p/727443#M56406</guid>
      <dc:creator>MikeMatthews</dc:creator>
      <dc:date>2012-02-07T17:33:36Z</dc:date>
    </item>
  </channel>
</rss>

