<?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: How to edit a graphic, or query a GraphicsLayer? in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-edit-a-graphic-or-query-a-graphicslayer/m-p/1550939#M85933</link>
    <description>&lt;P&gt;Check out the section called "Add an array of client-side features" in the expand section called "Creating a FeatureLayer" in &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html" target="_self"&gt;this&lt;/A&gt; help doc.&amp;nbsp; Also, check out the '&lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-views-layers-FeatureLayerView.html#dataUpdating" target="_self"&gt;dataUpdating&lt;/A&gt;' property of the FeatureLayerView.&lt;/P&gt;</description>
    <pubDate>Tue, 22 Oct 2024 15:41:16 GMT</pubDate>
    <dc:creator>JohnGrayson</dc:creator>
    <dc:date>2024-10-22T15:41:16Z</dc:date>
    <item>
      <title>How to edit a graphic, or query a GraphicsLayer?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-edit-a-graphic-or-query-a-graphicslayer/m-p/1550626#M85927</link>
      <description>&lt;P&gt;I'm trying to allow the user to edit a graphic (to drag the points on a polyline) by clicking on it - I'm using GraphicsLayer.&amp;nbsp;&lt;A href="https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/can-graphics-layers-be-queried/td-p/613949" target="_blank" rel="noopener"&gt;https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/can-graphics-layers-be-queried/td-p/613949&lt;/A&gt;On this post, I read that queryFeatures are not available on GraphicsLayer, and in order to query it, you have to convert the GraphicsLayer into a FeatureLayer.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried the solution from&amp;nbsp; that past, with this code:&amp;nbsp;&lt;BR /&gt;```&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;let&lt;/SPAN&gt; &lt;SPAN&gt;layer&lt;/SPAN&gt; &lt;SPAN&gt;=&lt;/SPAN&gt; &lt;SPAN&gt;new&lt;/SPAN&gt; &lt;SPAN&gt;FeatureLayer&lt;/SPAN&gt;&lt;SPAN&gt;({&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;source&lt;/SPAN&gt;&lt;SPAN&gt;:&lt;/SPAN&gt; &lt;SPAN&gt;tracksLayer&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;graphics&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;_items&lt;/SPAN&gt;&lt;SPAN&gt;,&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;objectIdField&lt;/SPAN&gt;&lt;SPAN&gt;:&lt;/SPAN&gt; &lt;SPAN&gt;"ObjectID"&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; });&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;arcgisView&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;whenLayerView&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;layer&lt;/SPAN&gt;&lt;SPAN&gt;).&lt;/SPAN&gt;&lt;SPAN&gt;then&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;function&lt;/SPAN&gt;&lt;SPAN&gt; (&lt;/SPAN&gt;&lt;SPAN&gt;lyrView&lt;/SPAN&gt;&lt;SPAN&gt;) {&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;console&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;log&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;lyrView&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;lyrView.watch("updating", function (val) {&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;if (!val) { &amp;nbsp;// wait for the layer view to finish updating&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;lyrView.queryFeatures().then(function (results) {&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; console.log(results); &amp;nbsp;// prints all the client-side graphics to the console&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;});&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;});&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; })&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;```&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;And I get the following error:&lt;BR /&gt;```{name: 'view:no-layerview-for-layer', details: {…}, message: 'No layerview has been found for the layer'}```&lt;BR /&gt;&lt;BR /&gt;I'm not sure if using tracksLayer.graphics._items was correct. tracksLayer is my GraphicsLayer.&lt;BR /&gt;Also, I'm not sure of the use of&amp;nbsp;&lt;SPAN&gt; &amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;objectIdField&lt;/SPAN&gt;&lt;SPAN&gt;:&lt;/SPAN&gt; &lt;SPAN&gt;"ObjectID" (I got that from the documentation).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Is there something I'm missing?&amp;nbsp;Or is there another way to allow the user to edit the points on a polyline (in GraphicsLayer?) without being able to query it? This approach of having to change a GraphicsLayer to a FeatureLayer seems too complex, and maybe I should just redo everything and create a FeatureLayer from the start?&lt;/P&gt;&lt;P&gt;Thanks so much for the help!&lt;/P&gt;</description>
      <pubDate>Mon, 21 Oct 2024 20:54:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-edit-a-graphic-or-query-a-graphicslayer/m-p/1550626#M85927</guid>
      <dc:creator>Sparkles</dc:creator>
      <dc:date>2024-10-21T20:54:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to edit a graphic, or query a GraphicsLayer?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-edit-a-graphic-or-query-a-graphicslayer/m-p/1550939#M85933</link>
      <description>&lt;P&gt;Check out the section called "Add an array of client-side features" in the expand section called "Creating a FeatureLayer" in &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html" target="_self"&gt;this&lt;/A&gt; help doc.&amp;nbsp; Also, check out the '&lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-views-layers-FeatureLayerView.html#dataUpdating" target="_self"&gt;dataUpdating&lt;/A&gt;' property of the FeatureLayerView.&lt;/P&gt;</description>
      <pubDate>Tue, 22 Oct 2024 15:41:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-edit-a-graphic-or-query-a-graphicslayer/m-p/1550939#M85933</guid>
      <dc:creator>JohnGrayson</dc:creator>
      <dc:date>2024-10-22T15:41:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to edit a graphic, or query a GraphicsLayer?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-edit-a-graphic-or-query-a-graphicslayer/m-p/1551449#M85944</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/11373"&gt;@JohnGrayson&lt;/a&gt;&amp;nbsp;, thanks for your response! Are you referring to this portion?&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;let features = [
 {
   geometry: {
     type: "point",
     x: -100,
     y: 38
   },
   attributes: {
     ObjectID: 1,
     DepArpt: "KATL",
     MsgTime: Date.now(),
     FltId: "UAL1"
   }
 },
 ...
];

// geometryType and spatialReference of the layer
// will be inferred from the first feature in the array
// if it has a geometry.
let layer = new FeatureLayer({
  source: features,  // autocast as a Collection of new Graphic()
  objectIdField: "ObjectID"
});&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;This is what I was looking at as an example for my code. Instead of making a custom features array in the example, I just used&amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;tracksLayer&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;graphics&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;_items (as that's what had my real data). Would I have to convert my data into that format? Thanks!&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 23 Oct 2024 17:22:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-edit-a-graphic-or-query-a-graphicslayer/m-p/1551449#M85944</guid>
      <dc:creator>Sparkles</dc:creator>
      <dc:date>2024-10-23T17:22:40Z</dc:date>
    </item>
  </channel>
</rss>

