Hi!
I have a GeoJSONlayer which I need to update occasionally with new features from a fetch-request, triggered by the user. Using version 4.19.
---------------
The fetch response is also a GeoJSON which I can make into a GEOJSONlayer with the following:
------------
However, I do not wish do make a new layer from the fetch response. I want to update my original GeoJSON layer with the features contained in the response. So I use applyEdits according to the following:
----------------
However, this does not work and the javascript console gives no clues. To be honest, I am not sure whether to use response_json, response_json.features or some variation of my "blob". I tried a lot of variations but it seems that the geographic information is lost somehow.
I have a working workaround, which is to create the NewGeoJSONLayer (which I don't want), query all features from that layer (which seems unnecessary since I want all features in my response_json) and then do the applyEdits with featureSet.features.
So, how can I use my response_json with applyEdits on my original layer directly? Thanks in advance for any help!
Have you seen the new enhancement to geojson layer in 4.22? I think this will do what you are looking for.
https://developers.arcgis.com/javascript/latest/release-notes/#layer-updates
@JanHellenberg , If you upgrade to 4.22, you will be able to do what you are asking with the use of GeoJSONLayer.customParameters and GeoJSONLayer.refresh.
The section @RobertScheitlin__GISP referenced in his answer explains the updates we installed at 4.22 for CSV and GeoJSONLayers. The following video explains what this means.
https://community.esri.com/t5/arcgis-api-for-javascript-blog/what-is-new-at-4-22-for-geojsonlayer-an...
This sample shows the updates in action.
Thanks and sorry for late reply, I had major issues updating from 4.19 to 4.22.
I have two questions: first, does the 4.22 GeoJSONLayer support POST method, which is required by the server in my case? I assumed that only GET is supported?
Secondly and related, in my example above I have parameters, headers and body which I send together with my Fetch POST request. How is the syntax for providing all these in the GeoJSONLayer properties, if possible at all?
I do something like this: