<?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: Points added with da.InsertCursor have different coordinates than those used to create the point in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/points-added-with-da-insertcursor-have-different/m-p/159584#M12220</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;Turns out the issue was not with the insert cursor, it was with the feature class creation itself. &amp;nbsp;It was created with the "entire" script and the coordinate system was set after the creation of the feature class with DefineProjection. &amp;nbsp;When the spatial reference was set (WGS84) at the time of feature class creation, the insert cursor created the points accurately. &amp;nbsp;We believe that when the projection was set after the feature class was created, the feature class was not updated before the points were added and it most likely did something with the precision / scale. &amp;nbsp;Thanks for your feedback.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 24 Jul 2017 19:48:39 GMT</pubDate>
    <dc:creator>AnneHagerman</dc:creator>
    <dc:date>2017-07-24T19:48:39Z</dc:date>
    <item>
      <title>Points added with da.InsertCursor have different coordinates than those used to create the point</title>
      <link>https://community.esri.com/t5/python-questions/points-added-with-da-insertcursor-have-different/m-p/159578#M12214</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have over 2000 kmz files each with one kml for one point - tree locations. &amp;nbsp;From each file, I am extracting the x &amp;amp; y coordinates and using an insert cursor to add the point with the WGS 84 x &amp;amp; y. &amp;nbsp;Many of the trees are only meters apart and what seems to be happening many tree points are being placed on top of each other at a "rounded" long / lat location. &amp;nbsp;Although it keeps the 6 decimal places, they all default to the same incorrect long / lat. &amp;nbsp;I've taken a subset of my code with just the insert cursor code to show here and it gives the same incorrect results.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;import arcpy&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;fc = r"D:\ProjectData\FPI_ARCTIC\02_Working\Interiror\Kamloops\StemMaps_1.gdb\Trees"&lt;/P&gt;&lt;P&gt;fields = ["SHAPE@XY", "TREE_NUM"]&lt;BR /&gt;# GCS = WGS 84&lt;BR /&gt;sr = arcpy.Describe(fc).spatialReference&lt;BR /&gt;arcpy.env.outputCoordinateSystem = sr&lt;/P&gt;&lt;P&gt;iCursor = arcpy.da.InsertCursor(fc, fields)&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;xCoord = -119.822445&lt;BR /&gt;yCoord = 50.449748&lt;BR /&gt;##point = arcpy.Point(xCoord, yCoord)&lt;BR /&gt;xy = (xCoord, yCoord)&lt;/P&gt;&lt;P&gt;iCursor.insertRow((xy, 90))&lt;/P&gt;&lt;P&gt;del iCursor&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have 6 points that are close to these (only the last 3 decimal places change) that are all defaulting to this long / lat:&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/363841_pastedImage_2.png" style="width: auto; height: auto;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As you can see, although the xCoord and yCoord are the degrees passed in, the point is created at -199.822388 and 50.44989. &amp;nbsp;I've also tried using &lt;A href="mailto:SHAPE@"&gt;SHAPE@ &lt;/A&gt;and a point geometry (commented out) and passing in the point instead of the xy with the same results. &amp;nbsp;I can't find any documentation talking about the insert cursor's precision with x / y in degrees. &amp;nbsp;Does anyone know why this might be happening? &amp;nbsp;.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 21 Jul 2017 18:42:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/points-added-with-da-insertcursor-have-different/m-p/159578#M12214</guid>
      <dc:creator>AnneHagerman</dc:creator>
      <dc:date>2017-07-21T18:42:53Z</dc:date>
    </item>
    <item>
      <title>Re: Points added with da.InsertCursor have different coordinates than those used to create the point</title>
      <link>https://community.esri.com/t5/python-questions/points-added-with-da-insertcursor-have-different/m-p/159579#M12215</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Anne,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You are adding the point through the cursor, then calculating the values of the POINT_X, and POINT_Y fields correct? &amp;nbsp;I would look at your precision and scale values for these fields.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You need to make sure these fields are:&lt;BR /&gt;&lt;STRONG&gt;Type&lt;/STRONG&gt;: DOUBLE&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Precision&lt;/STRONG&gt;: 9&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Scale&lt;/STRONG&gt;: 6&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I used your coordinates and input them through your cursor in a test feature class, then I calculated my field values in these two columns and they returned the coordinates exactly.&lt;/P&gt;&lt;P&gt;&lt;IMG __jive_id="363893" class="image-3 jive-image" src="https://community.esri.com/legacyfs/online/363893_pastedImage_8.png" style="width: auto; height: auto;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;IMG __jive_id="363772" class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/363772_pastedImage_4.png" style="width: auto; height: auto;" /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;IMG __jive_id="363894" class="jive-image image-4" src="https://community.esri.com/legacyfs/online/363894_pastedImage_1.png" style="width: auto; height: auto;" /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;IMG __jive_id="363887" class="image-2 jive-image" src="https://community.esri.com/legacyfs/online/363887_pastedImage_5.png" style="width: auto; height: auto;" /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The coordinates are being written correctly as the geometry. &amp;nbsp;However, if you scale and precision are off, when you calculate these other fields directly the coordinates will round based on your precision/scale.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;~Alex&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 21 Jul 2017 19:48:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/points-added-with-da-insertcursor-have-different/m-p/159579#M12215</guid>
      <dc:creator>AlexanderBrown5</dc:creator>
      <dc:date>2017-07-21T19:48:42Z</dc:date>
    </item>
    <item>
      <title>Re: Points added with da.InsertCursor have different coordinates than those used to create the point</title>
      <link>https://community.esri.com/t5/python-questions/points-added-with-da-insertcursor-have-different/m-p/159580#M12216</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Anne...tTo ensure geometries use the spatial reference needed, you can set it at the cursor level&lt;/P&gt;&lt;P&gt;&lt;A href="http://desktop.arcgis.com/en/arcmap/latest/analyze/python/setting-a-cursor-s-spatial-reference.htm"&gt;http://desktop.arcgis.com/en/arcmap/latest/analyze/python/setting-a-cursor-s-spatial-reference.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;this ensures that it is used over any global settings.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 21 Jul 2017 19:55:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/points-added-with-da-insertcursor-have-different/m-p/159580#M12216</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2017-07-21T19:55:06Z</dc:date>
    </item>
    <item>
      <title>Re: Points added with da.InsertCursor have different coordinates than those used to create the point</title>
      <link>https://community.esri.com/t5/python-questions/points-added-with-da-insertcursor-have-different/m-p/159581#M12217</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Dan for the response. &amp;nbsp;I did come across the help page you referenced above. &amp;nbsp;Search Cursors and Update Cursors do allow you to set a spatial reference, however, Insert Cursors only have 2 inputs:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;PRE style="color: #4d4d4d; background-color: #fefefe; font-size: 0.75em; margin-bottom: 1.5em;"&gt;InsertCursor (in_table, field_names)&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;I could not figure out a way to set the spatial reference for my Insert Cursor.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 24 Jul 2017 17:53:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/points-added-with-da-insertcursor-have-different/m-p/159581#M12217</guid>
      <dc:creator>AnneHagerman</dc:creator>
      <dc:date>2017-07-24T17:53:06Z</dc:date>
    </item>
    <item>
      <title>Re: Points added with da.InsertCursor have different coordinates than those used to create the point</title>
      <link>https://community.esri.com/t5/python-questions/points-added-with-da-insertcursor-have-different/m-p/159582#M12218</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Alex. &amp;nbsp;Thanks for the response. &amp;nbsp;My issue is not really with calculating the X and Y coordinates, it's with the creation of the actual points themselves. &amp;nbsp;So, when I use that script and create the point from the xy variable, it actually gets created at (&lt;SPAN style="background-color: #ffffff;"&gt;-199.822388,&amp;nbsp;&lt;SPAN&gt;50.44989) instead of my xy input of (-119.822445,&amp;nbsp;50.449748). &amp;nbsp;Any thoughts?&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 24 Jul 2017 18:02:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/points-added-with-da-insertcursor-have-different/m-p/159582#M12218</guid>
      <dc:creator>AnneHagerman</dc:creator>
      <dc:date>2017-07-24T18:02:57Z</dc:date>
    </item>
    <item>
      <title>Re: Points added with da.InsertCursor have different coordinates than those used to create the point</title>
      <link>https://community.esri.com/t5/python-questions/points-added-with-da-insertcursor-have-different/m-p/159583#M12219</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Anne,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you run just the snippet you posted, the values are getting created at&amp;nbsp;&lt;SPAN style="background-color: #ffffff;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="background-color: #ffffff; border: 0px;"&gt;-199.822388,&amp;nbsp;&lt;SPAN style="border: 0px; font-weight: inherit;"&gt;50.44989)? &amp;nbsp;What is the output coordinate system of the target feature class?&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="border: 0px; background-color: #ffffff; font-weight: inherit;"&gt;~Alex&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 24 Jul 2017 19:41:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/points-added-with-da-insertcursor-have-different/m-p/159583#M12219</guid>
      <dc:creator>AlexanderBrown5</dc:creator>
      <dc:date>2017-07-24T19:41:36Z</dc:date>
    </item>
    <item>
      <title>Re: Points added with da.InsertCursor have different coordinates than those used to create the point</title>
      <link>https://community.esri.com/t5/python-questions/points-added-with-da-insertcursor-have-different/m-p/159584#M12220</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;Turns out the issue was not with the insert cursor, it was with the feature class creation itself. &amp;nbsp;It was created with the "entire" script and the coordinate system was set after the creation of the feature class with DefineProjection. &amp;nbsp;When the spatial reference was set (WGS84) at the time of feature class creation, the insert cursor created the points accurately. &amp;nbsp;We believe that when the projection was set after the feature class was created, the feature class was not updated before the points were added and it most likely did something with the precision / scale. &amp;nbsp;Thanks for your feedback.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 24 Jul 2017 19:48:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/points-added-with-da-insertcursor-have-different/m-p/159584#M12220</guid>
      <dc:creator>AnneHagerman</dc:creator>
      <dc:date>2017-07-24T19:48:39Z</dc:date>
    </item>
    <item>
      <title>Re: Points added with da.InsertCursor have different coordinates than those used to create the point</title>
      <link>https://community.esri.com/t5/python-questions/points-added-with-da-insertcursor-have-different/m-p/1393491#M70029</link>
      <description>&lt;P&gt;Hi Anne,&lt;/P&gt;&lt;P&gt;I'm guessing you figured this out by now, seeing how you posted your question in 2017 &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&amp;nbsp; but for others,&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can specify the spatial reference of a point before inserting it in the data:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;pt = arcpy.Point(-12683890.6, 5811151.5)
pt_geometry = arcpy.PointGeometry(pt, spatial_reference=3857)&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Mar 2024 22:26:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/points-added-with-da-insertcursor-have-different/m-p/1393491#M70029</guid>
      <dc:creator>LauraTateosian_augori</dc:creator>
      <dc:date>2024-03-08T22:26:12Z</dc:date>
    </item>
  </channel>
</rss>

