<?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: SOLVED: [esri.views.LayerViewManager] Failed to create layerview for layer title:'GeoJSON' on ArcGIS 4.21.x in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/solved-esri-views-layerviewmanager-failed-to/m-p/1117368#M75304</link>
    <description>&lt;P&gt;Hi there,&amp;nbsp;&lt;/P&gt;&lt;P&gt;This sounds like a legitimate bug. Will test locally and create an issue to fix it. I will let you know when it is fixed. I also want to point out that GeoJSONLayer will not be editable by default starting at version 4.22. You will need to set its&amp;nbsp;editingEnabled property to true to edit your geojson features.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;-Undral&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 16 Nov 2021 18:43:57 GMT</pubDate>
    <dc:creator>UndralBatsukh</dc:creator>
    <dc:date>2021-11-16T18:43:57Z</dc:date>
    <item>
      <title>SOLVED: [esri.views.LayerViewManager] Failed to create layerview for layer title:'GeoJSON' on ArcGIS 4.21.x</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/solved-esri-views-layerviewmanager-failed-to/m-p/1117051#M75297</link>
      <description>&lt;P&gt;I am unable to see the geojson layer when I switch between map view and scene view after I apply edits to a GeoJSONLayer. I am seeing the following errors, and the layer doesn't get rendered:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;react_devtools_backend.js:2540 [esri.views.3d.layers.GeoJSONLayerView3D] #resolve() Failed to resolve layer view (layer title: 'GeoJSON', id: '17d25b1be7e-layer-4') TypeError: s.equals is not a function&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;at s (projectExtentUtils.js:5)&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;at FeatureLikeLayerView3D.js:5&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;react_devtools_backend.js:2540 [esri.views.LayerViewManager] Failed to create layerview for layer title:'GeoJSON', id:'17d25b1be7e-layer-4' of type 'geojson'&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;The errors happen after I apply edits to an existing GeoJSONLayer. I think I have found the problem: when ApplyEdits() is called, certain properties belonging to the feature are changed, even though I didn't change them. The below pic shows a comparison of the same feature before (right) and after (left) applyEdits is called. You can see the&amp;nbsp;&lt;STRONG&gt;fullExtent&amp;nbsp;&lt;/STRONG&gt;property has changed, which is referenced in the code throwing the error.&lt;/P&gt;&lt;P&gt;---------------------&lt;/P&gt;&lt;P&gt;SOLUTION: So after applyEdits the fullExtent property of the modified layer gets changed, which causes an error upon toggling mapView/sceneView. The solution is to store the original fullExtent and reassign it to the layer after its features have been updated. This seems like a bug since I don't see it documented anywhere.&lt;/P&gt;&lt;P&gt;---------------------&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="problem with applyEdits features.png" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/27529i7BBA794CE7D928C2/image-size/large?v=v2&amp;amp;px=999" role="button" title="problem with applyEdits features.png" alt="problem with applyEdits features.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Here is the code where I call applyEdits() on a geojsonlayer&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;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;  private handleHighlightEvent(layer: GeoJSONLayer): void {
   const query = layer.createQuery();
    query.where = "featureId = '" + this.id + "'"; // select the feature by attribute

    layer.queryFeatures(query).then((results) =&amp;gt; {
      const features = results.features;
      this.updateFeatures(features, layer);
    });
  }

  private updateFeatures(results, layer: GeoJSONLayer)
  {
    if (results.length &amp;gt;  0)
    {
      const updatedGraphics = {
        updateFeatures: []
      }

      results.forEach((feature) =&amp;gt; {
        const isStyleChanged: boolean = feature.attributes[UNIQUE_VALUE_RENDERER_FIELD] != this.style;
        feature.attributes[UNIQUE_VALUE_RENDERER_FIELD] = this.style; // apply an alternate style to feature
        if (isStyleChanged) // if style changed update graphic
        {
          updatedGraphics.updateFeatures.push(feature); // update feature
        }
      })

      if (updatedGraphics.updateFeatures.length &amp;gt; 0){
        this.applyEditsToGeoJSON(updatedGraphics, layer); // causes error when toggling 
      }

    }
  }

  private applyEditsToGeoJSON(params, layer: GeoJSONLayer)
  {
    layer.applyEdits(params);
  }&lt;/LI-CODE&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;&lt;P&gt;&amp;nbsp;&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, 16 Nov 2021 17:23:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/solved-esri-views-layerviewmanager-failed-to/m-p/1117051#M75297</guid>
      <dc:creator>ironmaskito</dc:creator>
      <dc:date>2021-11-16T17:23:37Z</dc:date>
    </item>
    <item>
      <title>Re: SOLVED: [esri.views.LayerViewManager] Failed to create layerview for layer title:'GeoJSON' on ArcGIS 4.21.x</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/solved-esri-views-layerviewmanager-failed-to/m-p/1117368#M75304</link>
      <description>&lt;P&gt;Hi there,&amp;nbsp;&lt;/P&gt;&lt;P&gt;This sounds like a legitimate bug. Will test locally and create an issue to fix it. I will let you know when it is fixed. I also want to point out that GeoJSONLayer will not be editable by default starting at version 4.22. You will need to set its&amp;nbsp;editingEnabled property to true to edit your geojson features.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;-Undral&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 16 Nov 2021 18:43:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/solved-esri-views-layerviewmanager-failed-to/m-p/1117368#M75304</guid>
      <dc:creator>UndralBatsukh</dc:creator>
      <dc:date>2021-11-16T18:43:57Z</dc:date>
    </item>
  </channel>
</rss>

