<?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 bulk applyEdits to a GeoJSONLayer in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/bulk-applyedits-to-a-geojsonlayer/m-p/1146925#M76445</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I am trying to partially reuse the example described in this sample:&lt;BR /&gt;&lt;A href="https://developers.arcgis.com/javascript/latest/sample-code/layers-featurelayer-collection-edits/" target="_blank"&gt;https://developers.arcgis.com/javascript/latest/sample-code/layers-featurelayer-collection-edits/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;But using a GeoJSONlayer instead of a FeatureLayer.&lt;/P&gt;&lt;P&gt;In the code snippet below, the "geojson" variable is just a geojson object that contain 25 features (points).&lt;/P&gt;&lt;P&gt;When using featurelayer.applyEdits(), it plots all the points on the map.&lt;/P&gt;&lt;P&gt;While using&amp;nbsp;geojsonlayer.applyEdits(), it just plots either 1 point, sometimes 2 points.&lt;/P&gt;&lt;P&gt;When inspecting the "console.log(editsResult)" in both cases 25 items have been added ("editsResult.addFeatureResults" property), but with geojsonlayer the objectids are the same&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any idea why this happens?&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;for (feature of geojson.features){
 let point = {
  type: "point",  
  longitude: feature.geometry.coordinates[0],
  latitude: feature.geometry.coordinates[1]
 }

 let pointGraphic = new Graphic({
  geometry: point
 })	 
 addFeatures.push(pointGraphic)
}

geojsonlayer.applyEdits({
 addFeatures:addFeatures
}).then((editsResult) =&amp;gt; {
 console.log(editsResult)
})&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;console.log(editResults):&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;{
    "addFeatureResults": [
        {
            "objectId": "__OBJECTID-17f26c9a7de",
            "globalId": null,
            "error": null
        },
        {
            "objectId": "__OBJECTID-17f26c9a7de",
            "globalId": null,
            "error": null
        },
        {
            "objectId": "__OBJECTID-17f26c9a7de",
            "globalId": null,
            "error": null
        },
        {
            "objectId": "__OBJECTID-17f26c9a7de",
            "globalId": null,
            "error": null
        },
        {
            "objectId": "__OBJECTID-17f26c9a7de",
            "globalId": null,
            "error": null
        },
        {
            "objectId": "__OBJECTID-17f26c9a7de",
            "globalId": null,
            "error": null
        },
        {
            "objectId": "__OBJECTID-17f26c9a7de",
            "globalId": null,
            "error": null
        },
        {
            "objectId": "__OBJECTID-17f26c9a7de",
            "globalId": null,
            "error": null
        },
        {
            "objectId": "__OBJECTID-17f26c9a7de",
            "globalId": null,
            "error": null
        },
        {
            "objectId": "__OBJECTID-17f26c9a7de",
            "globalId": null,
            "error": null
        },
        {
            "objectId": "__OBJECTID-17f26c9a7de",
            "globalId": null,
            "error": null
        },
        {
            "objectId": "__OBJECTID-17f26c9a7de",
            "globalId": null,
            "error": null
        },
        {
            "objectId": "__OBJECTID-17f26c9a7de",
            "globalId": null,
            "error": null
        },
        {
            "objectId": "__OBJECTID-17f26c9a7de",
            "globalId": null,
            "error": null
        },
        {
            "objectId": "__OBJECTID-17f26c9a7de",
            "globalId": null,
            "error": null
        },
        {
            "objectId": "__OBJECTID-17f26c9a7de",
            "globalId": null,
            "error": null
        },
        {
            "objectId": "__OBJECTID-17f26c9a7de",
            "globalId": null,
            "error": null
        },
        {
            "objectId": "__OBJECTID-17f26c9a7de",
            "globalId": null,
            "error": null
        },
        {
            "objectId": "__OBJECTID-17f26c9a7de",
            "globalId": null,
            "error": null
        },
        {
            "objectId": "__OBJECTID-17f26c9a7de",
            "globalId": null,
            "error": null
        },
        {
            "objectId": "__OBJECTID-17f26c9a7de",
            "globalId": null,
            "error": null
        },
        {
            "objectId": "__OBJECTID-17f26c9a7de",
            "globalId": null,
            "error": null
        },
        {
            "objectId": "__OBJECTID-17f26c9a7de",
            "globalId": null,
            "error": null
        },
        {
            "objectId": "__OBJECTID-17f26c9a7de",
            "globalId": null,
            "error": null
        },
        {
            "objectId": "__OBJECTID-17f26c9a7de",
            "globalId": null,
            "error": null
        }
    ],
    "updateFeatureResults": [],
    "deleteFeatureResults": [],
    "addAttachmentResults": [],
    "updateAttachmentResults": [],
    "deleteAttachmentResults": []
}&lt;/LI-CODE&gt;</description>
    <pubDate>Wed, 23 Feb 2022 13:38:28 GMT</pubDate>
    <dc:creator>ArnauForner</dc:creator>
    <dc:date>2022-02-23T13:38:28Z</dc:date>
    <item>
      <title>bulk applyEdits to a GeoJSONLayer</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/bulk-applyedits-to-a-geojsonlayer/m-p/1146925#M76445</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I am trying to partially reuse the example described in this sample:&lt;BR /&gt;&lt;A href="https://developers.arcgis.com/javascript/latest/sample-code/layers-featurelayer-collection-edits/" target="_blank"&gt;https://developers.arcgis.com/javascript/latest/sample-code/layers-featurelayer-collection-edits/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;But using a GeoJSONlayer instead of a FeatureLayer.&lt;/P&gt;&lt;P&gt;In the code snippet below, the "geojson" variable is just a geojson object that contain 25 features (points).&lt;/P&gt;&lt;P&gt;When using featurelayer.applyEdits(), it plots all the points on the map.&lt;/P&gt;&lt;P&gt;While using&amp;nbsp;geojsonlayer.applyEdits(), it just plots either 1 point, sometimes 2 points.&lt;/P&gt;&lt;P&gt;When inspecting the "console.log(editsResult)" in both cases 25 items have been added ("editsResult.addFeatureResults" property), but with geojsonlayer the objectids are the same&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any idea why this happens?&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;for (feature of geojson.features){
 let point = {
  type: "point",  
  longitude: feature.geometry.coordinates[0],
  latitude: feature.geometry.coordinates[1]
 }

 let pointGraphic = new Graphic({
  geometry: point
 })	 
 addFeatures.push(pointGraphic)
}

geojsonlayer.applyEdits({
 addFeatures:addFeatures
}).then((editsResult) =&amp;gt; {
 console.log(editsResult)
})&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;console.log(editResults):&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;{
    "addFeatureResults": [
        {
            "objectId": "__OBJECTID-17f26c9a7de",
            "globalId": null,
            "error": null
        },
        {
            "objectId": "__OBJECTID-17f26c9a7de",
            "globalId": null,
            "error": null
        },
        {
            "objectId": "__OBJECTID-17f26c9a7de",
            "globalId": null,
            "error": null
        },
        {
            "objectId": "__OBJECTID-17f26c9a7de",
            "globalId": null,
            "error": null
        },
        {
            "objectId": "__OBJECTID-17f26c9a7de",
            "globalId": null,
            "error": null
        },
        {
            "objectId": "__OBJECTID-17f26c9a7de",
            "globalId": null,
            "error": null
        },
        {
            "objectId": "__OBJECTID-17f26c9a7de",
            "globalId": null,
            "error": null
        },
        {
            "objectId": "__OBJECTID-17f26c9a7de",
            "globalId": null,
            "error": null
        },
        {
            "objectId": "__OBJECTID-17f26c9a7de",
            "globalId": null,
            "error": null
        },
        {
            "objectId": "__OBJECTID-17f26c9a7de",
            "globalId": null,
            "error": null
        },
        {
            "objectId": "__OBJECTID-17f26c9a7de",
            "globalId": null,
            "error": null
        },
        {
            "objectId": "__OBJECTID-17f26c9a7de",
            "globalId": null,
            "error": null
        },
        {
            "objectId": "__OBJECTID-17f26c9a7de",
            "globalId": null,
            "error": null
        },
        {
            "objectId": "__OBJECTID-17f26c9a7de",
            "globalId": null,
            "error": null
        },
        {
            "objectId": "__OBJECTID-17f26c9a7de",
            "globalId": null,
            "error": null
        },
        {
            "objectId": "__OBJECTID-17f26c9a7de",
            "globalId": null,
            "error": null
        },
        {
            "objectId": "__OBJECTID-17f26c9a7de",
            "globalId": null,
            "error": null
        },
        {
            "objectId": "__OBJECTID-17f26c9a7de",
            "globalId": null,
            "error": null
        },
        {
            "objectId": "__OBJECTID-17f26c9a7de",
            "globalId": null,
            "error": null
        },
        {
            "objectId": "__OBJECTID-17f26c9a7de",
            "globalId": null,
            "error": null
        },
        {
            "objectId": "__OBJECTID-17f26c9a7de",
            "globalId": null,
            "error": null
        },
        {
            "objectId": "__OBJECTID-17f26c9a7de",
            "globalId": null,
            "error": null
        },
        {
            "objectId": "__OBJECTID-17f26c9a7de",
            "globalId": null,
            "error": null
        },
        {
            "objectId": "__OBJECTID-17f26c9a7de",
            "globalId": null,
            "error": null
        },
        {
            "objectId": "__OBJECTID-17f26c9a7de",
            "globalId": null,
            "error": null
        }
    ],
    "updateFeatureResults": [],
    "deleteFeatureResults": [],
    "addAttachmentResults": [],
    "updateAttachmentResults": [],
    "deleteAttachmentResults": []
}&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 23 Feb 2022 13:38:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/bulk-applyedits-to-a-geojsonlayer/m-p/1146925#M76445</guid>
      <dc:creator>ArnauForner</dc:creator>
      <dc:date>2022-02-23T13:38:28Z</dc:date>
    </item>
    <item>
      <title>Re: bulk applyEdits to a GeoJSONLayer</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/bulk-applyedits-to-a-geojsonlayer/m-p/1147125#M76454</link>
      <description>&lt;P&gt;Hi there,&amp;nbsp;&lt;/P&gt;&lt;P&gt;Looks like the issue exists when you initialize the GeoJSONLayer with geojson features that have string feature.ids. In this case, features will have string objectIds. Then you are passing in graphics without attributes and applyEdits return inconsistent and incorrect results. We created an issue for this and I will update you here once it is fixed.&amp;nbsp;&lt;/P&gt;&lt;P&gt;This issue will go away if you remove the string feature.ids from your initial geojson feed. &lt;A href="https://codepen.io/U_B_U/pen/JjOZzzv?editors=100" target="_self"&gt;This app&lt;/A&gt; shows this scenario:&amp;nbsp;&lt;/P&gt;&lt;P&gt;Or set up your geojson objects to be added via applyEdits to match the geojson objects from the initial feed. &lt;A href="https://codepen.io/U_B_U/pen/rNYKogo?editors=1000" target="_self"&gt;This app&lt;/A&gt; shows this scenario.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope this helps,&lt;/P&gt;&lt;P&gt;-Undral&lt;/P&gt;</description>
      <pubDate>Wed, 23 Feb 2022 18:31:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/bulk-applyedits-to-a-geojsonlayer/m-p/1147125#M76454</guid>
      <dc:creator>UndralBatsukh</dc:creator>
      <dc:date>2022-02-23T18:31:55Z</dc:date>
    </item>
  </channel>
</rss>

