Hi, I have hosted a feature layer in ArcGIS Online 10.8 and created a feature layer view from the hosted feature layer. I consumed these two as portal items in my webmap application using ESRI JavaScript API 4.19.
It is required to find out which one is the feature layer view from these two portal items through the JavaScript API.
Names will be unique for these layer but however the need is to identify from the property/methods of these layers.
Kindly suggest me. Many thanks in advance!
Solved! Go to Solution.
The FeatureLayer.sourceJSON contains all the metadata from the FeatureLayer REST endpoint, including what you need to distinguish between the View Layer and original feature layer.
For example, in this case, the metadata JSON for hosted layer views include a "isView: true". So you could check for featureLayer.sourceJSON.isView .
https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#sourceJS...
https://services.arcgis.com/V6ZHFr6zdgNZuVG0/arcgis/rest/services/DrinkingWaterOSM_viewlayer/Feature...
The FeatureLayer.sourceJSON contains all the metadata from the FeatureLayer REST endpoint, including what you need to distinguish between the View Layer and original feature layer.
For example, in this case, the metadata JSON for hosted layer views include a "isView: true". So you could check for featureLayer.sourceJSON.isView .
https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#sourceJS...
https://services.arcgis.com/V6ZHFr6zdgNZuVG0/arcgis/rest/services/DrinkingWaterOSM_viewlayer/Feature...
Thanks a lot Bjorn. It works well as expected !