require(["esri/layers/catalog/catalogUtils"], (catalogUtils) => { /* code goes here */ });
import * as catalogUtils from "@arcgis/core/layers/catalog/catalogUtils.js";
esri/layers/catalog/catalogUtils
Provides utility functions for the CatalogLayer.
- See also
Method Overview
Name | Return Type | Summary | Object |
---|---|---|---|
Utility method to get the parent CatalogLayer for a given layer in CatalogDynamicGroupLayer.layers collection. | catalogUtils | ||
Utility method to check if the layer is temporarily available in the map and can be removed at any time because it is part of a CatalogLayer. | catalogUtils |
Method Details
-
getCatalogLayerForLayer
getCatalogLayerForLayer(layer){CatalogLayer |null |undefined}
-
Utility method to get the parent CatalogLayer for a given layer in CatalogDynamicGroupLayer.layers collection.
Parameterlayer LayerThe layer for which the CatalogLayer is to be retrieved.
ReturnsType Description CatalogLayer | null | undefined The catalog for that layer when it can be found. Example// Highlight the footprint for a layer if it's part of a catalog dynamic grouplayer. function highlightFootprintForLayer(view, layer) { const catalog = getCatalogLayerForLayer(layer); if (catalog) { const footprint = catalog.createFootprintFromLayer(layer); if (footprint) { const catalogLayerView = view.allLayerViews.find((layerView) => layerView.layer === catalog); return catalogLayerView?.footprintLayerView?.highlight(footprint); } } return { remove() {} }; }
-
isLayerFromCatalog
isLayerFromCatalog(layer){Boolean}
-
Utility method to check if the layer is temporarily available in the map and can be removed at any time because it is part of a CatalogLayer.
It recursively checks if the layer's parent is CatalogLayer.
Use this utility to selectively exclude layers from your user experience. For example, to limit the options available for these layers in the LayerList.
Parameterlayer LayerThe layer to test.
ReturnsType Description Boolean true
if the layer or its parent is part of a catalog.Example// Get all layer not part of a catalog. const layers = map.allLayers.filter((layer) => !isLayerFromCatalog(layer))