<?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: Problem with adding points into a feature class with arcpy in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/problem-with-adding-points-into-a-feature-class/m-p/240411#M18705</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;not sure, but the &lt;A href="http://desktop.arcgis.com/en/arcmap/latest/analyze/arcpy-classes/pointgeometry.htm"&gt;PointGeometry class&lt;/A&gt;&amp;nbsp;enables you to specify the spatial reference during the construction of the Point object... this rules out any possible misinterpretation of the full nature of the point object.&amp;nbsp; Worth a look to see if makes a difference especially if the dataframe is in a different coordinate system&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 17 Feb 2017 20:53:00 GMT</pubDate>
    <dc:creator>DanPatterson_Retired</dc:creator>
    <dc:date>2017-02-17T20:53:00Z</dc:date>
    <item>
      <title>Problem with adding points into a feature class with arcpy</title>
      <link>https://community.esri.com/t5/python-questions/problem-with-adding-points-into-a-feature-class/m-p/240410#M18704</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I'm trying to add a list of coordinates to a feature class in arcpy.&amp;nbsp; When I manually add each xy pair as graphics into arc map using the go to xy tool, the points show up where I expect them to:&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/325104_pastedImage_1.png" style="width: 620px; height: 452px;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, when I use arcpy, they are slightly offset:&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-2 jive-image" src="https://community.esri.com/legacyfs/online/325105_pastedImage_2.png" style="width: 620px; height: 453px;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is the code I'm using:&lt;/P&gt;&lt;P&gt;&amp;lt;code&amp;gt;&lt;/P&gt;&lt;P&gt;import arcpy, json, ConversionUtils&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;arcpy.Delete_management("in_memory")&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;coordinates = [&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;[-118.3436607214932, 34.18465195557297],&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;[-118.3437040116469, 34.18108463923645],&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;[-118.338436218283, 34.18097397459129],&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;[-118.3383716114292, 34.18454551218532],&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;[-118.3421286432001, 34.18221218702963],&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;[-118.3398871274149, 34.18236566520285]&lt;BR /&gt;]&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;feature_class = arcpy.CreateFeatureclass_management("in_memory", "temp_feature_class", "POINT")&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;cursor = arcpy.da.InsertCursor(feature_class, ['SHAPE@'])&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;points = []&lt;BR /&gt;for (x, y) in coordinates:&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;points.append(arcpy.Point(x, y))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for point in points:&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;cursor.insertRow([point])&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;BR /&gt;sr = arcpy.SpatialReference(4326)&lt;BR /&gt;arcpy.DefineProjection_management(feature_class, sr)&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;BR /&gt;arcpy.FeatureClassToShapefile_conversion(feature_class, "C:/Temp")&lt;/P&gt;&lt;P&gt;&amp;lt;/code&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is anyone able to reproduce this problem, and if so, what is causing it and what can I do to fix it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Jason&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Feb 2017 20:43:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/problem-with-adding-points-into-a-feature-class/m-p/240410#M18704</guid>
      <dc:creator>JasonLevine</dc:creator>
      <dc:date>2017-02-17T20:43:35Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with adding points into a feature class with arcpy</title>
      <link>https://community.esri.com/t5/python-questions/problem-with-adding-points-into-a-feature-class/m-p/240411#M18705</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;not sure, but the &lt;A href="http://desktop.arcgis.com/en/arcmap/latest/analyze/arcpy-classes/pointgeometry.htm"&gt;PointGeometry class&lt;/A&gt;&amp;nbsp;enables you to specify the spatial reference during the construction of the Point object... this rules out any possible misinterpretation of the full nature of the point object.&amp;nbsp; Worth a look to see if makes a difference especially if the dataframe is in a different coordinate system&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Feb 2017 20:53:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/problem-with-adding-points-into-a-feature-class/m-p/240411#M18705</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2017-02-17T20:53:00Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with adding points into a feature class with arcpy</title>
      <link>https://community.esri.com/t5/python-questions/problem-with-adding-points-into-a-feature-class/m-p/240412#M18706</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I agree with Dan that specifying spatial references is important with the ArcPy Geometry classes.&amp;nbsp; I can't remember where exactly it is documented, but the ArcPy Geometry classes will assume a simplified spatial reference, or spatial reference properties, when one is not specified.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Looking over your code, &lt;SPAN style="font-family: courier new,courier,monospace;"&gt;arcpy.Point&lt;/SPAN&gt; doesn't take a spatial reference, and you weren't using &lt;SPAN style="font-family: courier new,courier,monospace;"&gt;arcpy.PointGeometry&lt;/SPAN&gt;.&amp;nbsp; In this case, it was/is the lack of spatial reference with &lt;SPAN style="font-family: courier new,courier,monospace;"&gt;arcpy.CreateFeatureclass_management&lt;/SPAN&gt; that caused the issue.&amp;nbsp; Many tools, similar to the ArcPy Geometry classes, assume simplified spatial reference properties when one isn't explicitly specified.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Using the first set of coordinates, you can see the rounding that is occurring before you use &lt;SPAN style="font-family: courier new,courier,monospace;"&gt;arcpy.DefineProjection_management&lt;/SPAN&gt;.&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="operator token"&gt;&amp;gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;&amp;gt;&lt;/SPAN&gt; feature_class &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;CreateFeatureclass_management&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"in_memory"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"temp_feature_class"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"POINT"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="operator token"&gt;&amp;gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;&amp;gt;&lt;/SPAN&gt; cursor &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;da&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;InsertCursor&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;feature_class&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'SHAPE@'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="operator token"&gt;&amp;gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;&amp;gt;&lt;/SPAN&gt; cursor&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;insertRow&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;Point&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;-&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;118.3436607214932&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;34.18465195557297&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
1L
&lt;SPAN class="operator token"&gt;&amp;gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;&amp;gt;&lt;/SPAN&gt; pt &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;CopyFeatures_management&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;feature_class&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;Geometry&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;
&lt;SPAN class="operator token"&gt;&amp;gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;&amp;gt;&lt;/SPAN&gt; pt&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;getPart&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="operator token"&gt;&amp;lt;&lt;/SPAN&gt;Point &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;-&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;118.343688965&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;34.1846923828&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="comment token"&gt;#, #)&amp;gt;&lt;/SPAN&gt;
&lt;SPAN class="operator token"&gt;&amp;gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;&amp;gt;&lt;/SPAN&gt; &lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 12:05:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/problem-with-adding-points-into-a-feature-class/m-p/240412#M18706</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2021-12-11T12:05:22Z</dc:date>
    </item>
  </channel>
</rss>

