I have many web maps on Portal that have several web layers in each. They include dynamic services which are "map image layers" on portal, vector tile layers, and a cached basemap. I'm writing some code (API 3.24) that will run an identify task on only the dynamic layers (map image layers) in the map, and I want to ignore the rest of the layers. I used this code:
var webMapLayers = arrayUtils.map(this.map.layerIds, lang.hitch(this, function (layerId) {
return this.map.getLayer(layerId);
}));
to get a list of the layers in the map. If I log those on the console like this:
webMapLayers.forEach(function(element) { console.log(element); });
I see this in the browser console:
{_attrs: {…}, url: "https://myserver/arcgis/rest/services/BaseMap/BaseImage/MapServer", _url: {…}, spatialReference: {…}, initialExtent: {…}, …}
{_attrs: {…}, url: "https://myserver/arcgis/rest/services/Hosted/MAPvectorTiles/VectorTileServer", _url: {…}, spatialReference: {…}, initialExtent: {…}, …}
{_attrs: {…}, url: "https://myserver/arcgis/rest/services…Tiles/VectorTileServer/resources/styles/root.json", _url: {…}, spatialReference: {…}, initialExtent: {…}, …}
{_attrs: {…}, url: "https://myserver/arcgis/rest/services/TownMap_MIL1/MapServer", _url: {…}, spatialReference: {…}, initialExtent: {…}, …}
I can expand these and see hundreds, if not thousands of properties on each of these layers. I was hoping to find one property in there somewhere that would let me determine which layer(s) are "map image layers" or dynamic layers, so I can only use those layers for the identify Task, but after spending quite a bit of time combing through, and also looking at the API documentation, I can't find any common property between those four layer types that lets me tell them apart. I can of course manually tell which service is which by the service names, but I have a lot of webmaps all with different combinations of layers, and I want to write this code in a generic way so that no matter what is in the map, it will only pick out the dynamic (map image) layers.
Does anyone know an easy way to do this?