<?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: arcpy.da.InsertCursor - all features are inserted at the same location in ArcGIS API for Python Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-python-questions/arcpy-da-insertcursor-all-features-are-inserted-at/m-p/1041792#M5839</link>
    <description>&lt;P&gt;Can you print a few rows off using the options so we can see what is being returned compared to what is expected&lt;/P&gt;</description>
    <pubDate>Tue, 30 Mar 2021 02:43:20 GMT</pubDate>
    <dc:creator>DanPatterson</dc:creator>
    <dc:date>2021-03-30T02:43:20Z</dc:date>
    <item>
      <title>arcpy.da.InsertCursor - all features are inserted at the same location</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/arcpy-da-insertcursor-all-features-are-inserted-at/m-p/1041778#M5838</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I am using a arcpy to insert rows from a feature class into another but I realize that the features in the destination are loosing their location. They are all positionned at the location of the first one.&lt;/P&gt;&lt;P&gt;Curiously, if I am using the SHAPE@ token for the geometry field, the features location are correct but if I use &lt;A href="mailto:SHAPE@XY" target="_blank" rel="noopener"&gt;SHAPE@XY&lt;/A&gt;&amp;nbsp;or &lt;A href="mailto:SHAPE@JSON" target="_blank" rel="noopener"&gt;SHAPE@JSON&lt;/A&gt;&amp;nbsp;they are all at the location of the first feature. Also, the problem does not occur if I create the destination feature class manually with ArcMap, but only when creating it using arcpy.CreateFeatureClass_management like in the code below.&lt;/P&gt;&lt;P&gt;The shape type is point and the feature class is in a non-versioned dataset in 3857 (web mercator). This is a geodatabase enterprise (v10.6) with a postgresql (v9.6) database. I am using arcpy 64bits. The destination feature class &lt;STRONG&gt;has attchments enabled&lt;/STRONG&gt; and it seems to be the cause of the problem (see Edit 2 below)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import os, arcpy

WORKSPACE = os.path.join(r"\\sgoappwp01", "Script", "Connections", "sgopubwt02 - PostgrSQL.sde")
INPUT_FC = os.path.join(WORKSPACE, "CollecteEncombrants", "CollecteEncombrants_Formulaire")
OUTPUT_FC = os.path.join(WORKSPACE, "CollecteEncombrants", "CollecteEncombrants_Terrain")

arcpy.CreateFeatureclass_management(
  out_path = os.path.join(WORKSPACE, "CollecteEncombrants"),
  out_name = "CollecteEncombrants_Terrain",
  geometry_type = "POINT",
  spatial_reference = arcpy.SpatialReference(3857),
  has_m = "DISABLED",
  has_z = "DISABLED"
)

edit = arcpy.da.Editor(WORKSPACE)
edit.startEditing(False, False)
edit.startOperation()

rows = []
with arcpy.da.SearchCursor(INPUT_FC, ["SHAPE@JSON"]) as sCursor:
    for row in sCursor:
        rows.append(row)

with arcpy.da.InsertCursor(OUTPUT_FC, ["SHAPE@JSON"]) as iCursor:
    for row in rows:
        iCursor.insertRow(row)

edit.stopOperation()
edit.stopEditing(True)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any idea what could be wrong?&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;EDIT:&amp;nbsp; here some printed rows before and after the insert&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;#some rows just before being inserted

with arcpy.da.InsertCursor(OUTPUT_FC, ["SHAPE@JSON"]) as iCursor:
  for row in rows:
  print
  iCursor.insertRow(row)

(u'{"x":-7994810.0683999993,"y":5685131.9157000035,"spatialReference":{"wkid":102100,"latestWkid":3857}}',)
(u'{"x":-8007290.4016999993,"y":5685999.8158999979,"spatialReference":{"wkid":102100,"latestWkid":3857}}',)
(u'{"x":-8005971.6404999997,"y":5685563.5265000015,"spatialReference":{"wkid":102100,"latestWkid":3857}}',)
(u'{"x":-8003287.4274000004,"y":5684056.8937999979,"spatialReference":{"wkid":102100,"latestWkid":3857}}',)

#rows after being inserted
with arcpy.da.SearchCursor(OUTPUT_FC, ["SHAPE@JSON"]) as sCursor:
  for row in sCursor:
  print(row)

(u'{"x":-7994810.0683999993,"y":5685131.9157000035,"spatialReference":{"wkid":102100,"latestWkid":3857}}',)
(u'{"x":-7994810.0683999993,"y":5685131.9157000035,"spatialReference":{"wkid":102100,"latestWkid":3857}}',)
(u'{"x":-7994810.0683999993,"y":5685131.9157000035,"spatialReference":{"wkid":102100,"latestWkid":3857}}',)
(u'{"x":-7994810.0683999993,"y":5685131.9157000035,"spatialReference":{"wkid":102100,"latestWkid":3857}}',)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;EDIT 2:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;I think I have found the source of the problem. It seems it is related with the attachments.&lt;/P&gt;&lt;P&gt;The destination feature class&lt;STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;has attachment enabled&lt;/STRONG&gt;. If I remove the attachments the insert cursor is working as expected with&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A href="mailto:SHAPE@JSON" target="_blank" rel="nofollow noopener noreferrer"&gt;SHAPE@JSON&lt;/A&gt;&amp;nbsp;token. If I enable the attachment again, the problem is reappearing.&lt;/P&gt;&lt;P&gt;I still wonder why...&lt;/P&gt;</description>
      <pubDate>Tue, 30 Mar 2021 14:46:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/arcpy-da-insertcursor-all-features-are-inserted-at/m-p/1041778#M5838</guid>
      <dc:creator>MaximeDemers</dc:creator>
      <dc:date>2021-03-30T14:46:09Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy.da.InsertCursor - all features are inserted at the same location</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/arcpy-da-insertcursor-all-features-are-inserted-at/m-p/1041792#M5839</link>
      <description>&lt;P&gt;Can you print a few rows off using the options so we can see what is being returned compared to what is expected&lt;/P&gt;</description>
      <pubDate>Tue, 30 Mar 2021 02:43:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/arcpy-da-insertcursor-all-features-are-inserted-at/m-p/1041792#M5839</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2021-03-30T02:43:20Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy.da.InsertCursor - all features are inserted at the same location</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/arcpy-da-insertcursor-all-features-are-inserted-at/m-p/1041828#M5841</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am not sure you can use &lt;A href="mailto:SHAPE@JSON" target="_blank"&gt;SHAPE@JSON&lt;/A&gt;&amp;nbsp;in insert cursor even the docs does not say it.&lt;/P&gt;&lt;P&gt;You assume the software translate automatically the json to the geometry binary in the insert, I am not sure it happened in real life.&lt;/P&gt;&lt;P&gt;If it is point then &lt;A href="mailto:SHAPE@XY" target="_blank"&gt;SHAPE@XY&lt;/A&gt;&amp;nbsp;might work .&lt;/P&gt;&lt;P&gt;Is there any reason not to use SHAPE@&lt;/P&gt;&lt;P&gt;Have fun&lt;/P&gt;&lt;P&gt;Mody&lt;/P&gt;</description>
      <pubDate>Tue, 30 Mar 2021 04:51:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/arcpy-da-insertcursor-all-features-are-inserted-at/m-p/1041828#M5841</guid>
      <dc:creator>mody_buchbinder</dc:creator>
      <dc:date>2021-03-30T04:51:47Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy.da.InsertCursor - all features are inserted at the same location</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/arcpy-da-insertcursor-all-features-are-inserted-at/m-p/1041913#M5843</link>
      <description>&lt;P&gt;Hi!&lt;/P&gt;&lt;P&gt;That's the first thing I verified to debug, but everything seems correct with the inserted rows. You can see my edited post&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 30 Mar 2021 13:43:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/arcpy-da-insertcursor-all-features-are-inserted-at/m-p/1041913#M5843</guid>
      <dc:creator>MaximeDemers</dc:creator>
      <dc:date>2021-03-30T13:43:28Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy.da.InsertCursor - all features are inserted at the same location</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/arcpy-da-insertcursor-all-features-are-inserted-at/m-p/1041947#M5845</link>
      <description>&lt;P&gt;What if you try the same workflow but using file geodatabase?&amp;nbsp; Knowing whether it is EGDB related or a larger issue would be a good step.&lt;/P&gt;</description>
      <pubDate>Tue, 30 Mar 2021 14:11:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/arcpy-da-insertcursor-all-features-are-inserted-at/m-p/1041947#M5845</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2021-03-30T14:11:53Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy.da.InsertCursor - all features are inserted at the same location</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/arcpy-da-insertcursor-all-features-are-inserted-at/m-p/1041956#M5846</link>
      <description>&lt;P&gt;Hi!&amp;nbsp;&lt;/P&gt;&lt;P&gt;Very good suggestion but meanwhile I think I have found the source of the problem. It seems it is related with the attachments.&lt;/P&gt;&lt;P&gt;The destination feature class&lt;STRONG&gt; has attachment enabled&lt;/STRONG&gt;. If I remove the attachments the insert cursor is working as expected with &lt;A href="mailto:SHAPE@JSON" target="_blank"&gt;SHAPE@JSON&lt;/A&gt;&amp;nbsp;token. If I enable the attachment again, the problem is reappearing.&lt;/P&gt;&lt;P&gt;I still wonder why...&lt;/P&gt;</description>
      <pubDate>Tue, 30 Mar 2021 14:42:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/arcpy-da-insertcursor-all-features-are-inserted-at/m-p/1041956#M5846</guid>
      <dc:creator>MaximeDemers</dc:creator>
      <dc:date>2021-03-30T14:42:28Z</dc:date>
    </item>
  </channel>
</rss>

