import { isLayerFromCatalog, getCatalogLayerForLayer } from "@arcgis/core/layers/catalog/catalogUtils.js";const { isLayerFromCatalog, getCatalogLayerForLayer } = await $arcgis.import("@arcgis/core/layers/catalog/catalogUtils.js");Functions
| Name | Return Type | Object |
|---|---|---|
| | ||
| |
isLayerFromCatalog
Function
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.dynamicGroupLayer.
Use this utility to selectively exclude layers from your user experience. For example, to limit the options available for these layers in the LayerList.
- Signature
-
isLayerFromCatalog (layer: Layer): boolean
Parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
| layer | The layer to test. | |
- Returns
- boolean
trueif 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)) getCatalogLayerForLayer
Function
Utility method to get the parent CatalogLayer for a given layer in CatalogDynamicGroupLayer.layers collection.
- Signature
-
getCatalogLayerForLayer (layer: Layer): CatalogLayer | null | undefined
Parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
| layer | The layer for which the CatalogLayer is to be retrieved. | |
- Returns
- 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() {} };}