<?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: Automatic X and Y in Attribute Table in Data Management Questions</title>
    <link>https://community.esri.com/t5/data-management-questions/automatic-x-and-y-in-attribute-table/m-p/166378#M9294</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Where would I put this code?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 02 Jan 2015 20:48:22 GMT</pubDate>
    <dc:creator>deleted-user-_umMO8elsPd4</dc:creator>
    <dc:date>2015-01-02T20:48:22Z</dc:date>
    <item>
      <title>Automatic X and Y in Attribute Table</title>
      <link>https://community.esri.com/t5/data-management-questions/automatic-x-and-y-in-attribute-table/m-p/166376#M9292</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I work for a water/ww utility, and we are trying to map our system. I mostly have the map together to start collecting points. We are using Mobile GIS on a handheld device.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I can't figure out how to automatically add X and Y coordinates to the attribute table. I created domains for most of the fields, but I'm not so sure about this. When I collect a point, it collects the X,Y... but doesn't show it in the Attribute Table. I have found ways to manually add the columns, but don't want to have to do that every time. Is there a way I can create a domain, or whatever else, to make that happen?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 31 Dec 2014 22:49:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/automatic-x-and-y-in-attribute-table/m-p/166376#M9292</guid>
      <dc:creator>deleted-user-_umMO8elsPd4</dc:creator>
      <dc:date>2014-12-31T22:49:51Z</dc:date>
    </item>
    <item>
      <title>Re: Automatic X and Y in Attribute Table</title>
      <link>https://community.esri.com/t5/data-management-questions/automatic-x-and-y-in-attribute-table/m-p/166377#M9293</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you want to update all feature classes in a workspace, you could use some Python code to do so:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy
import os

ws = r"C:\Forum\DistLinePol\test.gdb"
fld_x = "POINT_X"
fld_y = "POINT_Y"

arcpy.env.workspace = ws
fds = arcpy.ListDatasets()
fds.append("")
for fd in fds:
&amp;nbsp;&amp;nbsp;&amp;nbsp; fcs = arcpy.ListFeatureClasses(feature_dataset=fd)
&amp;nbsp;&amp;nbsp;&amp;nbsp; for fc in fcs:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fcl = os.path.join(ws, fd, fc)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; shape_type = arcpy.Describe(fcl).shapeType
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if len(arcpy.ListFields(fcl, fld_x)) == 0:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddField_management(fcl, fld_x, "DOUBLE")
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if len(arcpy.ListFields(fcl, fld_y)) == 0:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddField_management(fcl, fld_y, "DOUBLE")
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; with arcpy.da.UpdateCursor(fcl, ("SHAPE@", fld_x, fld_y)) as curs:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for row in curs:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if shape_type == "Point":
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; row[1] = row[0].firstPoint.X
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; row[2] = row[0].firstPoint.Y
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; elif shape_type == "Polyline":
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pnt = row[0].positionAlongLine(0.5, True)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; row[1] = pnt.firstPoint.X
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; row[2] = pnt.firstPoint.Y
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; elif shape_type == "Polygon":
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; row[1] = row[0].centroid.X
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; row[2] = row[0].centroid.Y
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; curs.updateRow(row)&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Change the values on line 4 to 6 to set the path to the workspace and the fields to update. If the fields don't exist they are added in the process.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 08:40:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/automatic-x-and-y-in-attribute-table/m-p/166377#M9293</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2021-12-11T08:40:53Z</dc:date>
    </item>
    <item>
      <title>Re: Automatic X and Y in Attribute Table</title>
      <link>https://community.esri.com/t5/data-management-questions/automatic-x-and-y-in-attribute-table/m-p/166378#M9294</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Where would I put this code?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 02 Jan 2015 20:48:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/automatic-x-and-y-in-attribute-table/m-p/166378#M9294</guid>
      <dc:creator>deleted-user-_umMO8elsPd4</dc:creator>
      <dc:date>2015-01-02T20:48:22Z</dc:date>
    </item>
    <item>
      <title>Re: Automatic X and Y in Attribute Table</title>
      <link>https://community.esri.com/t5/data-management-questions/automatic-x-and-y-in-attribute-table/m-p/166379#M9295</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Another way is to add the XY data in Desktop after you are done collecting the data points.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Open the point feature class in Desktop.&lt;/P&gt;&lt;P&gt;Check your projection under Dataframe Properties to be sure you are using your projection of choice.&lt;/P&gt;&lt;P&gt;Open the Attribute table.&lt;/P&gt;&lt;P&gt;If you have not already, add 2 new fields called "X" and "Y" (or whatever you like).&lt;/P&gt;&lt;P&gt;Right click on the new "X" field header and choose "Calculate Geometry".&lt;/P&gt;&lt;P&gt;Chose Yes to continue at the warning pop-up.&lt;/P&gt;&lt;P&gt;You will see it has a Property drop down to select the X or Y coordinate (choose X for the X column and Y for the Y column !) .&lt;/P&gt;&lt;P&gt;You can pick the data source projection or your dataframe's projection (if different).&lt;/P&gt;&lt;P&gt;Repeat for the "Y" field in the table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Good luck!&lt;/P&gt;&lt;P&gt;&lt;IMG alt="Capture5.PNG" class="jive-image image-1" src="https://community.esri.com/legacyfs/online/46644_Capture5.PNG" style="width: 620px; height: 376px;" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 02 Jan 2015 21:49:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/automatic-x-and-y-in-attribute-table/m-p/166379#M9295</guid>
      <dc:creator>TimMarquardt1</dc:creator>
      <dc:date>2015-01-02T21:49:09Z</dc:date>
    </item>
    <item>
      <title>Re: Automatic X and Y in Attribute Table</title>
      <link>https://community.esri.com/t5/data-management-questions/automatic-x-and-y-in-attribute-table/m-p/166380#M9296</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Alex,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The steps are as follows (using the python window and not the standalone method in a python IDE): &lt;/P&gt;&lt;UL&gt;&lt;LI&gt;copy the code to a text editor like notepad or notepad++ (don't use IE, since it will probably copy the line numbers as well)&lt;/LI&gt;&lt;LI&gt;In the text editor change the values in line 4 to 6 to match your data&lt;/LI&gt;&lt;LI&gt;Copy the text (code) to the clipboard&lt;/LI&gt;&lt;LI&gt;In ArcMap, show the python window: click on the Python Window button to the right of the standard toolbar:&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;IMG alt="ExecuteCode01.png" class="jive-image image-1" src="https://community.esri.com/legacyfs/online/46645_ExecuteCode01.png" style="width: 620px; height: 114px;" /&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;This will open the python window (probably floating)&lt;/LI&gt;&lt;LI&gt;Right click in the Python window as select Paste:&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;IMG alt="ExecuteCode02.png" class="jive-image image-2" src="https://community.esri.com/legacyfs/online/46847_ExecuteCode02.png" style="width: 620px; height: 178px;" /&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Press the Enter key until the code executes (probably twice)&lt;/LI&gt;&lt;LI&gt;After execution you will see the prompt: "&amp;gt;&amp;gt;&amp;gt; "&lt;/LI&gt;&lt;LI&gt;Check your data to see if it worked&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In case of any error message post it here and we'll see what is going wrong.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 03 Jan 2015 16:52:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/automatic-x-and-y-in-attribute-table/m-p/166380#M9296</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2015-01-03T16:52:31Z</dc:date>
    </item>
    <item>
      <title>Re: Automatic X and Y in Attribute Table</title>
      <link>https://community.esri.com/t5/data-management-questions/automatic-x-and-y-in-attribute-table/m-p/166381#M9297</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I thought the idea was to do this automatically as the post title states. This sounds pretty manual to me.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 03 Jan 2015 16:53:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/automatic-x-and-y-in-attribute-table/m-p/166381#M9297</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2015-01-03T16:53:25Z</dc:date>
    </item>
    <item>
      <title>Re: Automatic X and Y in Attribute Table</title>
      <link>https://community.esri.com/t5/data-management-questions/automatic-x-and-y-in-attribute-table/m-p/166382#M9298</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Alex,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;the add X Y Coordinates Tool may be of use:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://resources.arcgis.com/en/help/main/10.1/index.html#//001700000032000000" title="http://resources.arcgis.com/en/help/main/10.1/index.html#//001700000032000000"&gt;ArcGIS Help 10.1&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you are only updating a single file it should be pretty simple to create a stand alone Python file (.py) that you can call from a windows scheduled task at what ever time interval you like (could be at the end of each day).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if you want to update multiple files then you would need to combine the code with Xanders to loop through all of your feature classes in a folder.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Anthony &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 03 Jan 2015 17:26:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/automatic-x-and-y-in-attribute-table/m-p/166382#M9298</guid>
      <dc:creator>AnthonyGiles</dc:creator>
      <dc:date>2015-01-03T17:26:44Z</dc:date>
    </item>
    <item>
      <title>Re: Automatic X and Y in Attribute Table</title>
      <link>https://community.esri.com/t5/data-management-questions/automatic-x-and-y-in-attribute-table/m-p/166383#M9299</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The code can be easily expanded to loop through multiple locations of data. If that is what suits your specific case.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 03 Jan 2015 18:09:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/automatic-x-and-y-in-attribute-table/m-p/166383#M9299</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2015-01-03T18:09:04Z</dc:date>
    </item>
    <item>
      <title>Re: Automatic X and Y in Attribute Table</title>
      <link>https://community.esri.com/t5/data-management-questions/automatic-x-and-y-in-attribute-table/m-p/166384#M9300</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I ran your code with lines 4-6 as:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ws = r"Y:\GIS\MU Geodatabase.gdb\Sanitary_Sewer"&lt;/P&gt;&lt;P&gt;fld_x = "Point_X"&amp;nbsp; &lt;/P&gt;&lt;P&gt;fld_y = "Point_Y"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I created a mobile cache, put it on the handheld, collected points, and updated my map with the new points.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Data didn't show up in the new fields (Point_X and Point Y). The just filled in with 0's. I left my original fields that I had added manually (Easting_X and Northing_Y) just to compare.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="SewerAttribute.PNG" class="jive-image image-1" src="https://community.esri.com/legacyfs/online/47649_SewerAttribute.PNG" style="width: 620px; height: 511px;" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 05 Jan 2015 22:55:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/automatic-x-and-y-in-attribute-table/m-p/166384#M9300</guid>
      <dc:creator>deleted-user-_umMO8elsPd4</dc:creator>
      <dc:date>2015-01-05T22:55:45Z</dc:date>
    </item>
    <item>
      <title>Re: Automatic X and Y in Attribute Table</title>
      <link>https://community.esri.com/t5/data-management-questions/automatic-x-and-y-in-attribute-table/m-p/166385#M9301</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;What if you run it with:&lt;/P&gt;&lt;PRE __default_attr="python" __jive_macro_name="code" class="jive_macro_code jive_text_macro _jivemacro_uid_14204995103402248" jivemacro_uid="_14204995103402248"&gt;&lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;ws = r"Y:\GIS\MU Geodatabase.gdb"&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;... without specifying "Sanitary_Sewer" what I assume is a feature dataset. If that does not work, please attach a sample of you data to debug the code.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 05 Jan 2015 23:12:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/automatic-x-and-y-in-attribute-table/m-p/166385#M9301</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2015-01-05T23:12:53Z</dc:date>
    </item>
  </channel>
</rss>

