@arcgis/core
Version:
ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API
192 lines (188 loc) • 10.5 kB
TypeScript
import type GraphicsLayer from "./GraphicsLayer.js";
import type Layer from "./Layer.js";
import type { MultiOriginJSONSupportMixin } from "../core/MultiOriginJSONSupport.js";
import type { BlendLayer, BlendLayerProperties } from "./mixins/BlendLayer.js";
import type { OperationalLayer, OperationalLayerProperties } from "./mixins/OperationalLayer.js";
import type { PortalLayer, PortalLayerProperties } from "./mixins/PortalLayer.js";
import type { ScaleRangeLayer, ScaleRangeLayerProperties } from "./mixins/ScaleRangeLayer.js";
import type { LayerProperties } from "./Layer.js";
export interface MapNotesLayerProperties extends LayerProperties, PortalLayerProperties, OperationalLayerProperties, ScaleRangeLayerProperties, BlendLayerProperties {
/**
* Indicates how the layer should display in the [LayerList](https://developers.arcgis.com/javascript/latest/references/core/widgets/LayerList/) widget.
* The possible values are listed below.
*
* Value | Description
* ------|------------
* show | The layer is visible in the table of contents.
* hide | The layer is hidden in the table of contents.
* hide-children | If the layer is a [GroupLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/GroupLayer/), [BuildingSceneLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/BuildingSceneLayer/), [KMLLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/KMLLayer/), [MapImageLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/MapImageLayer/), [MapNotesLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/MapNotesLayer/), [TileLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/TileLayer/) or [WMSLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/WMSLayer/), hide the children layers from the table of contents.
*
* @default "hide-children"
*/
listMode?: "show" | "hide" | "hide-children";
/**
* The title of the layer used to identify it in places such as the [LayerList](https://developers.arcgis.com/javascript/latest/references/core/widgets/LayerList/)
* and [Popup](https://developers.arcgis.com/javascript/latest/references/core/widgets/Popup/) widgets.
*
* @default "Map Notes"
*/
title?: string | null;
}
/**
* The MapNotesLayer lets you display and modify map notes (features sketched on a web map) from the
* [Map Viewer](https://www.arcgis.com/apps/mapviewer/index.html). A new MapNotesLayer can also be created
* using the [SketchViewModel](https://developers.arcgis.com/javascript/latest/references/core/widgets/Sketch/SketchViewModel/) in a 2D [MapView](https://developers.arcgis.com/javascript/latest/references/core/views/MapView/).
*
* MapNotesLayer organizes the map notes into 5 layer types in a `sublayers` collection:
* [multipointLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/MapNotesLayer/#multipointLayer), [pointLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/MapNotesLayer/#pointLayer), [polygonLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/MapNotesLayer/#polygonLayer),
* [polylineLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/MapNotesLayer/#polylineLayer), and [textLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/MapNotesLayer/#textLayer). Each of these layers are GraphicLayers.
* The title (for the [LayerList](https://developers.arcgis.com/javascript/latest/references/core/widgets/LayerList/) widget), popupTemplate, geometry, and symbology can be updated and persisted.
*
* Map notes are part of web maps, and are typically created with the Map Viewer. For additional information, please refer to the
* ArcGIS Online documentation on how to
* [Add Map notes](https://doc.arcgis.com/en/arcgis-online/create-maps/create-sketch-layers-mv.htm).
* Within the [web map specification](https://developers.arcgis.com/web-map-specification/), map notes are a special type of
* [FeatureCollections](https://developers.arcgis.com/web-map-specification/objects/featureCollection/).
*
* Map notes created with Map Viewer Classic can be displayed, but the map notes cannot be modifed or accessed with this class.
* To find if the map notes in the MapNotesLayer can be edited, you can check the [capabilities.operations.supportsMapNotesEditing](https://developers.arcgis.com/javascript/latest/references/core/layers/MapNotesLayer/#capabilities)
* property value.
*
* > [!WARNING]
* >
* > **Known Limitations**
* >
* > Currently, MapNotesLayer is not supported in 3D [SceneViews](https://developers.arcgis.com/javascript/latest/references/core/views/SceneView/).
* > MapNotesLayer does not support the [Legend](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-legend/).
* > Changes to the visibility, scale range, and opacity properties are not persisted.
* > Map notes created with Map Viewer Classic do not support editing, and do not display sublayers in the [LayerList](https://developers.arcgis.com/javascript/latest/references/core/widgets/LayerList/) widget.
*
* The following snippet demonstrates how to load an existing webmap that contains a MapNotes layer.
* ```js
* const map = new WebMap({
* portalItem: {
* id: "6b3bfc4900214761a709b5d5a6a3d92b"
* }
* });
*
* const view = new MapView({
* container: "viewDiv",
* map
* });
*
* view.when(() => {
* // get the layer type ("map-notes")
* console.log(map.layers.at(0).type);
* // get the title
* console.log(map.layers.items[0].sublayers.items[0].sublayers.items[0].attributes.title);
* // update the popupTemplate
* map.layers.items[0].sublayers.items[1].sublayers.items[0].popupTemplate.content = "{title} has an updated popup";
* });
* ```
*
* This snippet create a new MapView and load a MapNotes layer from an existing portal item.
* ```js
* const map = new Map({
* basemap: "topo-vector"
* });
*
* const view = new MapView({
* container: "viewDiv",
* map
* });
*
* const promise = Layer.fromPortalItem({
* portalItem: {
* id: "2e2f6840647d4cb9a384532652e5100f"
* }
* });
* promise.then((layer) => {
* console.log(layer.type); // "map-notes"
* map.add(layer);
*
* Promise.all([view.when(), layer.load()]).then(() => {
* view.goTo(layer.fullExtent);
* });
* });
* ```
*
* @since 4.4
* @see [Map](https://developers.arcgis.com/javascript/latest/references/core/Map/)
* @see [WebMap](https://developers.arcgis.com/javascript/latest/references/core/WebMap/)
* @see [SketchViewModel](https://developers.arcgis.com/javascript/latest/references/core/widgets/Sketch/SketchViewModel/)
* @see [Sample - MapNotesLayer](https://developers.arcgis.com/javascript/latest/sample-code/layers-mapnoteslayer/)
*/
export default class MapNotesLayer extends MapNotesLayerSuperclass {
constructor(properties?: MapNotesLayerProperties);
/**
* Describes the layer's supported capabilities.
*
* @since 4.19
*/
get capabilities(): MapNotesLayerCapabilities;
/**
* Indicates how the layer should display in the [LayerList](https://developers.arcgis.com/javascript/latest/references/core/widgets/LayerList/) widget.
* The possible values are listed below.
*
* Value | Description
* ------|------------
* show | The layer is visible in the table of contents.
* hide | The layer is hidden in the table of contents.
* hide-children | If the layer is a [GroupLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/GroupLayer/), [BuildingSceneLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/BuildingSceneLayer/), [KMLLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/KMLLayer/), [MapImageLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/MapImageLayer/), [MapNotesLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/MapNotesLayer/), [TileLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/TileLayer/) or [WMSLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/WMSLayer/), hide the children layers from the table of contents.
*
* @default "hide-children"
*/
accessor listMode: "show" | "hide" | "hide-children";
/**
* A layer containing a collection of graphics with multipoint geometry.
*
* @since 4.19
*/
get multipointLayer(): GraphicsLayer | null | undefined;
/**
* A layer containing a collection of graphics with point geometry.
*
* @since 4.19
*/
get pointLayer(): GraphicsLayer | null | undefined;
/**
* A layer containing a collection of graphics with polygon geometry.
*
* @since 4.19
*/
get polygonLayer(): GraphicsLayer | null | undefined;
/**
* A layer containing a collection of graphics with polyline geometry.
*
* @since 4.19
*/
get polylineLayer(): GraphicsLayer | null | undefined;
/**
* A layer containing a collection of text graphics with point geometry.
*
* @since 4.19
*/
get textLayer(): GraphicsLayer | null | undefined;
/**
* The title of the layer used to identify it in places such as the [LayerList](https://developers.arcgis.com/javascript/latest/references/core/widgets/LayerList/)
* and [Popup](https://developers.arcgis.com/javascript/latest/references/core/widgets/Popup/) widgets.
*
* @default "Map Notes"
*/
accessor title: string | null | undefined;
/** The layer type provides a convenient way to check the type of the layer without the need to import specific layer modules. */
get type(): "map-notes";
}
declare const MapNotesLayerSuperclass: typeof Layer & typeof MultiOriginJSONSupportMixin & typeof PortalLayer & typeof OperationalLayer & typeof ScaleRangeLayer & typeof BlendLayer
export interface MapNotesLayerCapabilities {
/** Describes operations that can be performed on map notes in the layer. */
operations: MapNotesLayerCapabilitiesOperations;
}
export interface MapNotesLayerCapabilitiesOperations {
/**
* Indicates if map notes in the layer can be edited. Map notes
* created with the Map Viewer will have a value of `true`. Map notes created with the Map Viewer Classic will
* have a value of `false`.
*/
supportsMapNotesEditing: boolean;
}