I would like to fetch an ArcGIS featurelayer and get information on its properties and capabilities but I have no interest in rendering it in a map or a table. Is there a trick to load the featurelayer without inserting it in a map and view? Unless I do that I cannot figure out how to get its loaded property to be true.
var featureLayer = new FeatureLayer({
url: url
});
featureLayer.when(function () {
// fires when layer is loaded:
console.log(featureLayer.capabilities);
//... do something with capabilities here...
});
// Do I really need to load the map and view modules?
var map = new Map({
basemap: "oceans",
layers: featureLayer
});
var view = new MapView({
map: map,
container: "viewDiv"
});
// after above is complete, layer will be loaded but is there
// a better way to avoid loading all this extra stuff?
I'm currently doing a straight fetch to get the layer's JSON information and parsing it manually but obviously would like to use the ArcGIS Javascript API to reduce the work and lines of code.
Solved! Go to Solution.
Ryan,
If all you want is the capabilities and you are not going to do anything with the layer then just use an esriRequest to get the Rest Service details. Here is a sample that shows that (no map used).
https://developers.arcgis.com/javascript/latest/sample-code/request/index.html
Ryan,
If all you want is the capabilities and you are not going to do anything with the layer then just use an esriRequest to get the Rest Service details. Here is a sample that shows that (no map used).
https://developers.arcgis.com/javascript/latest/sample-code/request/index.html
Makes sense. Looks the same as the native Fetch() method with the benefit that it works on IE. Thanks for your help.