import type PopupTemplate from "../PopupTemplate.js"; import type Extent from "../geometry/Extent.js"; import type Layer from "./Layer.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 { 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"; export interface DimensionFeatureLayerProperties 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 a * [DimensionFeatureLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/DimensionFeatureLayer/). * * 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/DimensionFeatureLayer/#createPopupTemplate) * @see [SceneView.popup](https://developers.arcgis.com/javascript/latest/references/core/views/SceneView/#popup) * @see [View2D.popup](https://developers.arcgis.com/javascript/latest/references/core/views/View2D/#popup) */ popupTemplate?: PopupTemplateProperties | null; } export interface DimensionFeatureLayerEvents extends EditBusLayerEvents, RefreshableLayerEvents, LayerEvents {} /** * DimensionFeatureLayer is 2D-only, and is not supported in [3D SceneViews](https://developers.arcgis.com/javascript/latest/references/core/views/SceneView/). This layer is used for showing specific lengths or distances on a map. A dimension may indicate the length of a side of a building or land parcel, or the distance between two features, * such as a fire hydrant and the corner of a building. A dimension feature is composed of several parts that may or may not be displayed, depending on the application. These parts are each represented differently * using different symbology and placement rules. Dimension 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 a dimension feature: * *
* dimension *
This image shows a DimensionFeatureLayer visualizing distances.
*
* * DimensionFeatureLayer may be created from a [url](https://developers.arcgis.com/javascript/latest/references/core/layers/DimensionFeatureLayer/#url). * In the geodatabase, dimensions are stored in dimension feature classes. As with other feature classes in the geodatabase, all features in a dimension feature class have a geographic location and attributes and * can either be inside or outside a feature dataset. Like annotation features, dimension features are graphic features, and their symbology is stored in the geodatabase. * * ```js * // get a reference to arcgis-map * const viewElement = document.querySelector("arcgis-map"); * // Create a dimension feature layer from a feature service layer URL * const layer = new DimensionFeatureLayer({ * url: "https://sampleserver6.arcgisonline.com/arcgis/rest/services/LakeDimensions/FeatureServer/0" * }); * // add the layer to the map * viewElement.map.add(layer); * ``` * * > [!WARNING] * > * > **Notes** * > - The DimensionFeatureLayer 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 `styleCollection`. If these properties are not available * > from the service origin, the layer will fail to load. * > - The DimensionFeatureLayer requires `DIMLENGTH`, `BEGINX`, `BEGINY`, `ENDX`, `ENDY`, `DIMX`, `DIMY`, `TEXTX`, `TEXTY`, `DIMTYPE`, `EXTANGLE`, `STYLEID`, `USECUSTOMLENGTH`, `CUSTOMLENGTH`, `DIMDISPLAY`, `EXTDISPLAY`, `MARKERDISPLAY`, `TEXTANGLE` * > fields for proper functionality. If a required field is not present, the layer will fail. See [Dimension Fields](https://doc.esri.com/en/arcgis-pro/latest/help/data/dimensions/manage-dimension-feature-class-properties.html#34B) * > for more information on required fields. * > - The DimensionFeatureLayer does not support style collections with VBScript or JavaScript expressions. Only Arcade expressions are supported. * > - Editing is not supported in this release and will be supported in future releases. * * @beta * @since 5.1 * @see [Dimensions in ArcGIS Pro](https://doc.esri.com/en/arcgis-pro/latest/help/data/dimensions/dimensions-in-arcgis-pro.html) * @see [3D DimensionLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/DimensionLayer/) * @see [AnnotationFeatureLayer (beta)](https://developers.arcgis.com/javascript/latest/references/core/layers/AnnotationFeatureLayer/) */ export default class DimensionFeatureLayer extends DimensionFeatureLayerSuperclass { /** * @deprecated * Do not directly reference this property. * Use EventNames and EventTypes helpers from \@arcgis/core/Evented */ "@eventTypes": DimensionFeatureLayerEvents; /** * @example * // Create a dimension feature layer from a feature service layer URL. * ```js * const layer = new DimensionFeatureLayer({ * url: "https://sampleserver6.arcgisonline.com/arcgis/rest/services/Dimensions/FeatureServer/0" * }); * ``` */ constructor(properties?: DimensionFeatureLayerProperties); /** * An array of fields in the layer. * * @see [objectIdField](https://developers.arcgis.com/javascript/latest/references/core/layers/DimensionFeatureLayer/#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/DimensionFeatureLayerView/#queryFeatures) * if the fields are not part of required fields. * * @see [DimensionFeatureLayerView.availableFields](https://developers.arcgis.com/javascript/latest/references/core/views/layers/DimensionFeatureLayerView/#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 DimensionFeatureLayerView.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/DimensionFeatureLayer/#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/DimensionFeatureLayer/#createPopupTemplate) * @see [SceneView.popup](https://developers.arcgis.com/javascript/latest/references/core/views/SceneView/#popup) * @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 a * [DimensionFeatureLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/DimensionFeatureLayer/). * * 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/DimensionFeatureLayer/#createPopupTemplate) * @see [SceneView.popup](https://developers.arcgis.com/javascript/latest/references/core/views/SceneView/#popup) * @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); /** The layer type provides a convenient way to check the type of the layer without the need to import specific layer modules. */ get type(): "dimension-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; /** * 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 * > [DimensionFeatureLayerView.queryExtent()](https://developers.arcgis.com/javascript/latest/references/core/views/layers/DimensionFeatureLayerView/#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 * > [DimensionFeatureLayerView.queryFeatureCount()](https://developers.arcgis.com/javascript/latest/references/core/views/layers/DimensionFeatureLayerView/#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 * > [DimensionFeatureLayerView.queryFeatures()](https://developers.arcgis.com/javascript/latest/references/core/views/layers/DimensionFeatureLayerView/#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 * > [DimensionFeatureLayerView.queryObjectIds()](https://developers.arcgis.com/javascript/latest/references/core/views/layers/DimensionFeatureLayerView/#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 DimensionFeatureLayerSuperclass: typeof Layer & typeof ClonableMixin & typeof APIKeyMixin & typeof CustomParametersMixin & typeof MultiOriginJSONSupportMixin & typeof PortalLayer & typeof OperationalLayer & typeof RefreshableLayer & typeof ScaleRangeLayer & typeof TemporalLayer & typeof BlendLayer & typeof FeatureLayerBase