import type Graphic from "../Graphic.js"; import type PopupTemplate from "../PopupTemplate.js"; import type Collection from "../core/Collection.js"; import type Extent from "../geometry/Extent.js"; import type Layer from "./Layer.js"; import type AnnotationFeatureSublayer from "./support/AnnotationFeatureSublayer.js"; import type Field from "./support/Field.js"; import type FeatureSet from "../rest/support/FeatureSet.js"; import type Query from "../rest/support/Query.js"; import type { ClonableMixin } from "../core/Clonable.js"; import type { MultiOriginJSONSupportMixin } from "../core/MultiOriginJSONSupport.js"; import type { LayerEvents, LayerProperties } from "./Layer.js"; import type { APIKeyMixin, APIKeyMixinProperties } from "./mixins/APIKeyMixin.js"; import type { BlendLayer, BlendLayerProperties } from "./mixins/BlendLayer.js"; import type { CustomParametersMixin, CustomParametersMixinProperties } from "./mixins/CustomParametersMixin.js"; import type { EditBusLayer, EditBusLayerEvents } from "./mixins/EditBusLayer.js"; import type { FeatureLayerBase, FeatureLayerBaseProperties } from "./mixins/FeatureLayerBase.js"; import type { OperationalLayer, OperationalLayerProperties } from "./mixins/OperationalLayer.js"; import type { PortalLayer, PortalLayerProperties } from "./mixins/PortalLayer.js"; import type { RefreshableLayer, RefreshableLayerEvents, RefreshableLayerProperties } from "./mixins/RefreshableLayer.js"; import type { ScaleRangeLayer, ScaleRangeLayerProperties } from "./mixins/ScaleRangeLayer.js"; import type { TemporalLayer, TemporalLayerProperties } from "./mixins/TemporalLayer.js"; import type { RequestOptions } from "../request/types.js"; import type { QueryProperties } from "../rest/support/Query.js"; import type { CreatePopupTemplateOptions } from "../support/popupUtils.js"; import type { ObjectId } from "../views/types.js"; import type { PopupTemplateProperties } from "../PopupTemplate.js"; import type { AnnotationFeatureSublayerProperties } from "./support/AnnotationFeatureSublayer.js"; import type { ReadonlyArrayOrCollection } from "../core/Collection.js"; export interface AnnotationFeatureLayerProperties extends LayerProperties, APIKeyMixinProperties, CustomParametersMixinProperties, PortalLayerProperties, OperationalLayerProperties, RefreshableLayerProperties, ScaleRangeLayerProperties, TemporalLayerProperties, BlendLayerProperties, FeatureLayerBaseProperties, Partial> { /** * The popup template for the layer. When set on the layer, the `popupTemplate` * allows users to access attributes and display their values in the * view's Popup when a feature is selected * using text and/or charts. See the [PopupTemplate sample](https://developers.arcgis.com/javascript/latest/sample-code/intro-popuptemplate/) * for an example of how [PopupTemplate](https://developers.arcgis.com/javascript/latest/references/core/PopupTemplate/) interacts with an * [AnnotationFeatureLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/AnnotationFeatureLayer/). * * A default popup template is automatically used if no `popupTemplate` has been defined when * [Popup.defaultPopupTemplateEnabled](https://developers.arcgis.com/javascript/latest/references/core/widgets/Popup/#defaultPopupTemplateEnabled) * is set to `true`. * * @see [createPopupTemplate()](https://developers.arcgis.com/javascript/latest/references/core/layers/AnnotationFeatureLayer/#createPopupTemplate) * @see [View2D.popup](https://developers.arcgis.com/javascript/latest/references/core/views/View2D/#popup) */ popupTemplate?: PopupTemplateProperties | null; /** * A [Collection](https://developers.arcgis.com/javascript/latest/references/core/core/Collection/) of [AnnotationFeatureSublayer](https://developers.arcgis.com/javascript/latest/references/core/layers/support/AnnotationFeatureSublayer/) objects that allow * you to alter the visibility of one or more sublayers of the AnnotationFeatureLayer. * If this property is not specified, all the sublayers from the feature service are displayed as defined in the service. * * All sublayers must be referenced using the [AnnotationFeatureSublayer.subtypeCode](https://developers.arcgis.com/javascript/latest/references/core/layers/support/AnnotationFeatureSublayer/#subtypeCode) to identify the sublayer. The sublayers may be [added](https://developers.arcgis.com/javascript/latest/references/core/core/Collection/#add), * [removed](https://developers.arcgis.com/javascript/latest/references/core/core/Collection/#remove), or * [reordered](https://developers.arcgis.com/javascript/latest/references/core/core/Collection/#reorder) using the * [Collection](https://developers.arcgis.com/javascript/latest/references/core/core/Collection/) methods. Because [AnnotationFeatureSublayer](https://developers.arcgis.com/javascript/latest/references/core/layers/support/AnnotationFeatureSublayer/) extends * [Accessor](https://developers.arcgis.com/javascript/latest/references/core/core/Accessor/), its properties may be * [watched](https://developers.arcgis.com/javascript/latest/watch-for-changes/#watch-for-changes-in-the-api). * * @example * // Only includes the first AnnotationFeatureSublayer from the AnnotationFeatureLayer * let layer = new AnnotationFeatureLayer({ * url: "https://sampleserver6.arcgisonline.com/arcgis/rest/services/RiversAnnotation/FeatureServer/0", * sublayers: [{ * subtypeCode: 0, * visible: true * }] * }); */ sublayers?: ReadonlyArrayOrCollection; } export interface AnnotationFeatureLayerEvents extends EditBusLayerEvents, RefreshableLayerEvents, LayerEvents {} /** * An AnnotationFeatureLayer displays text as features in a 2D map. An annotation is a type of feature that consists of text with * position, layout, and style attributes. Initially, the AnnotationFeatureLayer will display all sublayers from the service, but you can configure the * visibility of each [AnnotationFeatureSublayer](https://developers.arcgis.com/javascript/latest/references/core/layers/support/AnnotationFeatureSublayer/) using the [visible](https://developers.arcgis.com/javascript/latest/references/core/layers/support/AnnotationFeatureSublayer/#visible) property * on each sublayer. Annotation features are not supported by the Legend component and the printed legend (it does print, but will not display in the printed legend). * Example of an annotation feature (see [Annotation in ArcGIS Pro](https://doc.esri.com/en/arcgis-pro/latest/help/data/annotation/annotation.html) * for more information on creating and publishing annotation features): * *
* annotation *
This image shows an AnnotationFeatureLayer representing wildfire burns and water features.
*
* * AnnotationFeatureLayers may be created from a [url](https://developers.arcgis.com/javascript/latest/references/core/layers/AnnotationFeatureLayer/#url). * AnnotationFeatureLayers are published with specific fonts and symbols to be used for display. Annotation features text use the same client-side rendering engine as labels. * If the font specified by the service is not available, a default font will be used instead. * See the [Labeling guide](https://developers.arcgis.com/javascript/latest/guide/labeling/) for more information on how to configure labeling and text symbols. * * ```js * // get a reference to arcgis-map * const viewElement = document.querySelector("arcgis-map"); * // Create an annotation feature layer from a feature service layer URL * const layer = new AnnotationFeatureLayer({ * url: "https://sampleserver6.arcgisonline.com/arcgis/rest/services/RiversAnnotation/FeatureServer/0" * }); * // add the layer to the map * viewElement.map.add(layer); * ``` * * > [!WARNING] * > * > **Notes** * > - The AnnotationFeatureLayer depends on the [queryDataElements](https://developers.arcgis.com/rest/services-reference/enterprise/query-data-elements-feature-service/) REST call to initialize correctly. * > The service must support this REST call for the layer to load. * > - The `queryDataElements` result must include the required properties, such as `referenceScale` and `symbolCollection`. If these properties are not available * > from the service origin, the layer will fail to load. * > - The AnnotationFeatureLayer requires `ZOrder`, `AnnotationClassID`, `Element`, `SymbolID`, `Status` fields * > for proper functionality. If a required field is not present, the layer will fail. See [Annotation Fields](https://doc.esri.com/en/arcgis-pro/latest/help/data/annotation/managing-annotation-feature-class-properties.html) * > for more information on required fields. * > - The AnnotationFeatureLayer does not support annotation features with `CIMTextGraphic`. Annotation features with `CIMTextGraphic` will not be displayed in the view. * > * > The following features are not currently supported in this release. Future releases will see increased functionality and support for additional features. * > - Editing * > - Unplaced annotations will not be visible. * * @beta * @since 5.1 * @see [AnnotationFeatureSublayer (beta)](https://developers.arcgis.com/javascript/latest/references/core/layers/support/AnnotationFeatureSublayer/) * @see [Labeling guide](/labeling/) * @see [Annotation in ArcGIS Pro](https://doc.esri.com/en/arcgis-pro/latest/help/data/annotation/annotation.html) * @see [DimensionFeatureLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/DimensionFeatureLayer/) */ export default class AnnotationFeatureLayer extends AnnotationFeatureLayerSuperclass { /** * @deprecated * Do not directly reference this property. * Use EventNames and EventTypes helpers from \@arcgis/core/Evented */ "@eventTypes": AnnotationFeatureLayerEvents; /** * @example * // Create an annotation layer from a feature service layer URL. * ```js * const layer = new AnnotationFeatureLayer({ * url: "https://sampleserver6.arcgisonline.com/arcgis/rest/services/RiversAnnotation/FeatureServer/0" * }); * ``` */ constructor(properties?: AnnotationFeatureLayerProperties); /** * An array of fields in the layer. * * @see [objectIdField](https://developers.arcgis.com/javascript/latest/references/core/layers/AnnotationFeatureLayer/#objectIdField) */ get fields(): Field[]; /** * An array of field names from the service to include with each feature. * To fetch the values from all fields in the layer, use `["*"]`. * Set this property to include the fields that will be used for client-side * [queries](https://developers.arcgis.com/javascript/latest/references/core/views/layers/AnnotationFeatureLayerView/#queryFeatures) * if the fields are not part of required fields. * * @see [AnnotationFeatureLayerView.availableFields](https://developers.arcgis.com/javascript/latest/references/core/views/layers/AnnotationFeatureLayerView/#availableFields) * @see [fieldUtils](https://developers.arcgis.com/javascript/latest/references/core/layers/support/fieldUtils/) * @example * // Includes all fields from the service in the layer * layer.outFields = ["*"]; * @example * // Get the specified fields from the service in the layer. * // These fields will be added to AnnotationFeatureLayerView.availableFields. * // Use these fields for client-side filtering and querying. * layer.outFields = ["NAME", "POP_2010", "FIPS", "AREA"]; */ accessor outFields: string[] | null | undefined; /** * Indicates whether to display popups when features in the layer are clicked. The layer needs to have a [popupTemplate](https://developers.arcgis.com/javascript/latest/references/core/layers/AnnotationFeatureLayer/#popupTemplate) to define what * information should be displayed in the popup. Alternatively, a default popup template may be automatically used if * [Popup.defaultPopupTemplateEnabled](https://developers.arcgis.com/javascript/latest/references/core/widgets/Popup/#defaultPopupTemplateEnabled) is set to `true`. * * @default true * @see [createPopupTemplate()](https://developers.arcgis.com/javascript/latest/references/core/layers/AnnotationFeatureLayer/#createPopupTemplate) * @see [View2D.popup](https://developers.arcgis.com/javascript/latest/references/core/views/View2D/#popup) */ accessor popupEnabled: boolean; /** * The popup template for the layer. When set on the layer, the `popupTemplate` * allows users to access attributes and display their values in the * view's Popup when a feature is selected * using text and/or charts. See the [PopupTemplate sample](https://developers.arcgis.com/javascript/latest/sample-code/intro-popuptemplate/) * for an example of how [PopupTemplate](https://developers.arcgis.com/javascript/latest/references/core/PopupTemplate/) interacts with an * [AnnotationFeatureLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/AnnotationFeatureLayer/). * * A default popup template is automatically used if no `popupTemplate` has been defined when * [Popup.defaultPopupTemplateEnabled](https://developers.arcgis.com/javascript/latest/references/core/widgets/Popup/#defaultPopupTemplateEnabled) * is set to `true`. * * @see [createPopupTemplate()](https://developers.arcgis.com/javascript/latest/references/core/layers/AnnotationFeatureLayer/#createPopupTemplate) * @see [View2D.popup](https://developers.arcgis.com/javascript/latest/references/core/views/View2D/#popup) */ get popupTemplate(): PopupTemplate | null | undefined; set popupTemplate(value: PopupTemplateProperties | null | undefined); /** * A [Collection](https://developers.arcgis.com/javascript/latest/references/core/core/Collection/) of [AnnotationFeatureSublayer](https://developers.arcgis.com/javascript/latest/references/core/layers/support/AnnotationFeatureSublayer/) objects that allow * you to alter the visibility of one or more sublayers of the AnnotationFeatureLayer. * If this property is not specified, all the sublayers from the feature service are displayed as defined in the service. * * All sublayers must be referenced using the [AnnotationFeatureSublayer.subtypeCode](https://developers.arcgis.com/javascript/latest/references/core/layers/support/AnnotationFeatureSublayer/#subtypeCode) to identify the sublayer. The sublayers may be [added](https://developers.arcgis.com/javascript/latest/references/core/core/Collection/#add), * [removed](https://developers.arcgis.com/javascript/latest/references/core/core/Collection/#remove), or * [reordered](https://developers.arcgis.com/javascript/latest/references/core/core/Collection/#reorder) using the * [Collection](https://developers.arcgis.com/javascript/latest/references/core/core/Collection/) methods. Because [AnnotationFeatureSublayer](https://developers.arcgis.com/javascript/latest/references/core/layers/support/AnnotationFeatureSublayer/) extends * [Accessor](https://developers.arcgis.com/javascript/latest/references/core/core/Accessor/), its properties may be * [watched](https://developers.arcgis.com/javascript/latest/watch-for-changes/#watch-for-changes-in-the-api). * * @example * // Only includes the first AnnotationFeatureSublayer from the AnnotationFeatureLayer * let layer = new AnnotationFeatureLayer({ * url: "https://sampleserver6.arcgisonline.com/arcgis/rest/services/RiversAnnotation/FeatureServer/0", * sublayers: [{ * subtypeCode: 0, * visible: true * }] * }); */ get sublayers(): Collection; set sublayers(value: ReadonlyArrayOrCollection); /** The layer type provides a convenient way to check the type of the layer without the need to import specific layer modules. */ get type(): "annotation-feature"; /** * Creates a popup template for the layer, populated with all the fields of the layer. * * @param options - Options for creating the popup template. * @returns The popup template, or `null` if the layer does not * have any fields. */ createPopupTemplate(options?: CreatePopupTemplateOptions): PopupTemplate | null | undefined; /** * Creates a query object that respects the layer's current filters. * * @returns A query object initialized from the layer configuration. */ createQuery(): Query; /** * Returns the sublayer to which the given feature belongs. * * @param feature - The feature whose sublayer will be returned. * @returns The sublayer from the `AnnotationFeatureLayer` to which the feature belongs to. */ findSublayerForFeature(feature: Graphic): AnnotationFeatureSublayer | null | undefined; /** * Returns the sublayer with the [SubtypeSublayer.subtypeCode](https://developers.arcgis.com/javascript/latest/references/core/layers/support/SubtypeSublayer/#subtypeCode) that matches the number passed as an argument. * * @param subtypeCode - The subtype coded value. * @returns The sublayer from the `AnnotationFeatureLayer` to which the feature belongs to. * @example * // Updates the visibility of a sublayer after first finding * // the sublayer from the subtypeCode. * const subtypeCode = 5; * const sublayer = annotationFeatureLayer.findSublayerForSubtypeCode(subtypeCode); * * sublayer.visible = true; */ findSublayerForSubtypeCode(subtypeCode: number): AnnotationFeatureSublayer | null | undefined; /** * Executes a [Query](https://developers.arcgis.com/javascript/latest/references/core/rest/support/Query/) against the feature service and returns the [Extent](https://developers.arcgis.com/javascript/latest/references/core/geometry/Extent/) of features that satisfy the query. If no * parameters are specified, then the extent and count of all features satisfying the layer's configuration/filters are returned. * * * > [!WARNING] * > - To query for the extent of features/graphics visible in the view on the client-side rather than making a server-side query, you must use the * > [AnnotationFeatureLayerView.queryExtent()](https://developers.arcgis.com/javascript/latest/references/core/views/layers/AnnotationFeatureLayerView/#queryExtent). * * * @param query - Specifies the attributes and spatial filter of the query. If no parameters are specified, then the extent and count of all features satisfying the layer's configuration/filters are returned. * @param options - Additional request options. See [RequestOptions](https://developers.arcgis.com/javascript/latest/references/core/request/types/#RequestOptions). * @returns When resolved, returns the extent and count of the features * that satisfy the input query. See the object specification table below for details. * Property | Type | Description * ---------|------|------------- * count | Number | The number of features that satisfy the input query. * extent | [Extent](https://developers.arcgis.com/javascript/latest/references/core/geometry/Extent/) | The extent of the features that satisfy the query. * @see [Sample - Zoom to extent of all features](https://developers.arcgis.com/javascript/latest/sample-code/featurelayer-queryextent/) * @example * ```js * // Queries for the extent of all features matching the layer's configurations * // e.g. definitionExpression * layer.queryExtent().then((result) =>{ * // go to the extent of the result satisfying the query * viewElement.goTo(result.extent); * }); * ``` * @example * ```js * const query = new Query(); * query.where = "region = 'Southern California'"; * * const result = await layer.queryExtent(query); * viewElement.goTo(result.extent); // go to the extent of the result satisfying the query * }); * ``` */ queryExtent(query?: QueryProperties | null | undefined, options?: RequestOptions): Promise<{ count: number; extent: Extent | null; }>; /** * Executes a [Query](https://developers.arcgis.com/javascript/latest/references/core/rest/support/Query/) against the feature service or layer data and * returns the number of features that satisfy the query. If no parameters are specified, * the total number of features satisfying the layer's configuration/filters is returned. * * * > [!WARNING] * > - To query the count of features available in the view on the client-side rather than making a server-side query, use * > [AnnotationFeatureLayerView.queryFeatureCount()](https://developers.arcgis.com/javascript/latest/references/core/views/layers/AnnotationFeatureLayerView/#queryFeatureCount). * * * @param query - Specifies the attributes and spatial filter of the query. If no parameters are specified, the total number of features satisfying the layer's configuration/filters is returned. * @param options - Additional request options. See [RequestOptions](https://developers.arcgis.com/javascript/latest/references/core/request/types/#RequestOptions). * @returns When resolved, returns the number of features that satisfy the query. * @see [Sample - Query features from a FeatureLayer](https://developers.arcgis.com/javascript/latest/sample-code/featurelayer-query/) * @example * ```js * // Queries for the count of all features matching the layer's configurations * // e.g. definitionExpression * layer.queryFeatureCount().then((numFeatures) => { * // prints the total count to the console * console.log(numFeatures); * }); * ``` * @example * ```js * const query = new Query(); * query.where = "region = 'Southern California'"; * * const featureCount = await layer.queryFeatureCount(query); * console.log(featureCount); // prints the number of results satisfying the query * ``` */ queryFeatureCount(query?: QueryProperties | null | undefined, options?: RequestOptions): Promise; /** * Executes a [Query](https://developers.arcgis.com/javascript/latest/references/core/rest/support/Query/) against a feature service or layer data and returns a * [FeatureSet](https://developers.arcgis.com/javascript/latest/references/core/rest/support/FeatureSet/) once the promise resolves. A FeatureSet contains an array of [features](https://developers.arcgis.com/javascript/latest/references/core/Graphic/). * * > [!WARNING] * > * > **Notes** * > - To query features visible in the view on the client-side rather than making a server-side query, use * > [AnnotationFeatureLayerView.queryFeatures()](https://developers.arcgis.com/javascript/latest/references/core/views/layers/AnnotationFeatureLayerView/#queryFeatures). * > - When querying a feature service with z-values and no [vertical coordinate system](https://doc.esri.com/en/arcgis-pro/latest/help/mapping/properties/vertical-coordinate-systems.html) * > information, z-values are automatically converted to match [Query.outSpatialReference](https://developers.arcgis.com/javascript/latest/references/core/rest/support/Query/#outSpatialReference) units. * > Example: The service has a horizontal spatial reference using `feet` units and the query is made with `outSpatialReference` * > based on `meter` units, then [FeatureLayer.queryFeatures()](https://developers.arcgis.com/javascript/latest/references/core/layers/FeatureLayer/#queryFeatures) automatically converts the values from `feet` to `meter` units. * * * @param query - Specifies the attributes and spatial filter of the query. If no parameters are specified, all features satisfying the layer's configuration/filters are returned. * @param options - Additional request options. See [RequestOptions](https://developers.arcgis.com/javascript/latest/references/core/request/types/#RequestOptions). * @returns When resolved, returns a [FeatureSet](https://developers.arcgis.com/javascript/latest/references/core/rest/support/FeatureSet/) containing an array of graphic features. * @see [Samples using queryFeatures() method](https://developers.arcgis.com/javascript/latest/sample-code/?tagged=queryfeatures) * @see [Query and filter guide](https://developers.arcgis.com/javascript/latest/query-filter/) * @example * ```js * // Queries for all the features matching the layer's configurations * // e.g. definitionExpression * const results = await layer.queryFeatures(); * // prints the array of result graphics to the console * console.log(results.features); * ``` * @example * ```js * // create a query object to filter features by setting desired properties * const query = new Query(); * query.where = "STATE_NAME = 'Washington'"; * query.outSpatialReference = { wkid: 102100 }; * query.returnGeometry = true; * query.outFields = [ "CITY_NAME" ]; * * const results = await layer.queryFeatures(query); * console.log(results.features); // prints the array of features to the console * ``` * @example * ```js * // Get a query object for the layer's current configuration * const queryParams = layer.createQuery(); * // set a geometry for filtering features by a region of interest * queryParams.geometry = extentForRegionOfInterest; * // Add to the layer's current definitionExpression * queryParams.where = queryParams.where + " AND TYPE = 'Extreme'"; * * // query the layer with the modified params object * const results = await layer.queryFeatures(queryParams); * // prints the array of result graphics to the console * console.log(results.features); * ``` * @example * ```js * // query all features from the layer and only return * // attributes specified in outFields. * const query = { // autocasts as Query * where: "1=1", // select all features * returnGeometry: false, * outFields: ["State_Name", "City_Name", "pop2010"] * }; * * const results = await layer.queryFeatures(query); * console.log(results.features); // prints the array of features to the console * ``` */ queryFeatures(query?: QueryProperties | null | undefined, options?: RequestOptions): Promise; /** * Executes a [Query](https://developers.arcgis.com/javascript/latest/references/core/rest/support/Query/) against the feature service and returns an * array of Object IDs for features that satisfy the input query. If no parameters are specified, * then the Object IDs of all features satisfying the layer's configuration/filters are returned. * * * > [!WARNING] * > - To query the ObjectIDs of features visible in the view on the client-side rather than making a server-side query, use * > [AnnotationFeatureLayerView.queryObjectIds()](https://developers.arcgis.com/javascript/latest/references/core/views/layers/AnnotationFeatureLayerView/#queryObjectIds). * * * @param query - Specifies the attributes and spatial filter of the query. If no parameters are specified, then the Object IDs of all features satisfying the layer's configuration/filters are returned. * @param options - Additional request options. See [RequestOptions](https://developers.arcgis.com/javascript/latest/references/core/request/types/#RequestOptions). * @returns When resolved, returns an array of numbers representing the object IDs of the features satisfying the query. * @see [Sample - Query Related Features](https://developers.arcgis.com/javascript/latest/sample-code/query-related-features/) * @example * ```js * // Queries for all the Object IDs of features matching the layer's configurations * // e.g. definitionExpression * layer.queryObjectIds().then((results) => { * // prints the array of Object IDs to the console * console.log(results); * }); * ``` * @example * ```js * const query = new Query({ * where: "SUB_REGION = 'Pacific'" * }); * * const ids = await layer.queryObjectIds(query); * console.log(ids); // an array of object IDs * ``` */ queryObjectIds(query?: QueryProperties | null | undefined, options?: RequestOptions): Promise; } declare const AnnotationFeatureLayerSuperclass: typeof Layer & typeof ClonableMixin & typeof APIKeyMixin & typeof CustomParametersMixin & typeof MultiOriginJSONSupportMixin & typeof PortalLayer & typeof OperationalLayer & typeof RefreshableLayer & typeof ScaleRangeLayer & typeof EditBusLayer & typeof TemporalLayer & typeof BlendLayer & typeof FeatureLayerBase