UNPKG

@arcgis/core

Version:

ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API

575 lines (573 loc) • 32.5 kB
import type Extent from "../../geometry/Extent.js"; import type SpatialReference from "../../geometry/SpatialReference.js"; import type EditFieldsInfo from "../support/EditFieldsInfo.js"; import type Field from "../support/Field.js"; import type FieldsIndex from "../support/FieldsIndex.js"; import type GeometryFieldsInfo from "../support/GeometryFieldsInfo.js"; import type LayerFloorInfo from "../support/LayerFloorInfo.js"; import type Relationship from "../support/Relationship.js"; import type Subtype from "../support/Subtype.js"; import type ElevationInfo from "../../symbols/support/ElevationInfo.js"; import type { EditingInfo, FeatureLayerCapabilities, FieldDomainOptions } from "../types.js"; import type { DomainUnion } from "../support/types.js"; import type { TimeZone } from "../../time/types.js"; import type { ElevationInfoProperties } from "../../symbols/support/ElevationInfo.js"; import type { LayerFloorInfoProperties } from "../support/LayerFloorInfo.js"; import type { ExtentProperties } from "../../geometry/Extent.js"; import type { SpatialReferenceProperties } from "../../geometry/SpatialReference.js"; export interface FeatureLayerBaseProperties extends Partial<Pick<FeatureLayerBase, "copyright" | "dateFieldsTimeZone" | "definitionExpression" | "displayField" | "gdbVersion" | "geometryType" | "globalIdField" | "hasM" | "hasZ" | "layerId" | "objectIdField" | "returnM" | "returnZ" | "sourceJSON" | "url">> { /** * Specifies how features are placed on the vertical axis (z). This property may only be used * in a [SceneView](https://developers.arcgis.com/javascript/latest/references/core/views/SceneView/). See the [ElevationInfo sample](https://developers.arcgis.com/javascript/latest/sample-code/scene-elevationinfo/) * for an example of how this property may be used. * * > [!WARNING] * > * > If the elevation info is not specified, the effective elevation depends on the context and could vary per graphic. */ elevationInfo?: ElevationInfoProperties | null; /** * When a feature layer is configured as floor-aware, it has a floorInfo property defined. * A floor-aware layer is a layer that contains indoor GIS data representing features that * can be located on a specific floor of a building. * * @since 4.19 */ floorInfo?: LayerFloorInfoProperties | null; /** The full extent of the layer. */ fullExtent?: ExtentProperties | null; /** * The historic moment to query. If historicMoment is not specified, the query * will apply to the current features. */ historicMoment?: (Date | number | string) | null; /** * The spatial reference of the layer. When creating the layer from a * [url](https://developers.arcgis.com/javascript/latest/references/core/layers/mixins/FeatureLayerBase/#url), the spatial reference is read from the service. * * When creating a FeatureLayer from client-side features, this property is * inferred from the geometries of the features provided in the layer's [source](https://developers.arcgis.com/javascript/latest/references/core/layers/FeatureLayer/#source) * property. */ spatialReference?: SpatialReferenceProperties; /** * The title of the layer used to identify it in places such as the [Legend](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-legend/) * and [LayerList](https://developers.arcgis.com/javascript/latest/references/core/widgets/LayerList/). * * When loading a layer by service url, the title is derived from the service name. * If the service has several layers, then the title of each layer will be the concatenation of the service name * and the layer name. * When the layer is loaded from a portal item, the title of the portal item will be used instead. * Finally, if a layer is loaded as part of a webmap or a webscene, then the title of the layer as stored in the webmap/webscene will be used. */ title?: string | null; } /** * FeatureLayerBase is a mixin that adds common properties and methods to [FeatureLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/FeatureLayer/), [SubtypeGroupLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/SubtypeGroupLayer/) and [CatalogLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/CatalogLayer/). * * @since 4.25 */ export abstract class FeatureLayerBase { constructor(...args: any[]); /** * Describes the layer's supported capabilities. * * @example * // Once the layer loads, check if the * // supportsAdd operations is enabled on the layer * await featureLayer.load(); * if (featureLayer.capabilities.operations.supportsAdd) { * // if new features can be created in the layer * // set up the UI for editing * setupEditing(); * } */ get capabilities(): FeatureLayerCapabilities; /** Copyright information for the layer. */ accessor copyright: string | null | undefined; /** * The time zone that dates are stored in. This property does not apply to date fields referenced by * [timeInfo](https://developers.arcgis.com/javascript/latest/references/core/layers/FeatureLayer/#timeInfo) or [editFieldsInfo](https://developers.arcgis.com/javascript/latest/references/core/layers/mixins/FeatureLayerBase/#editFieldsInfo). * * Even though dates are transmitted as UTC epoch values, this property may be useful when constructing date or time [where clauses for querying](https://developers.arcgis.com/javascript/latest/references/core/rest/support/Query/#date-query). * If constructing date or time where clauses, use [FieldsIndex.getTimeZone()](https://developers.arcgis.com/javascript/latest/references/core/layers/support/FieldsIndex/#getTimeZone) to get the * time zone for the given date field. * * Set this property in the layer constructor if you are creating [client-side](https://developers.arcgis.com/javascript/latest/references/core/layers/FeatureLayer/#client-side) feature layers * to indicate the time zone of the date fields. The [date field](https://developers.arcgis.com/javascript/latest/references/core/layers/support/Field/#type) must exist in the layer's `fields` array for client-side * [feature layers](https://developers.arcgis.com/javascript/latest/references/core/layers/FeatureLayer/#client-side) if the `dateFieldsTimeZone` is specified. * * @since 4.28 * @see [Wikipedia - List of tz database time zones](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones) * @see [Date and time queries](https://developers.arcgis.com/javascript/latest/references/core/rest/support/Query/#date-query) * @see [Date-time queries | Time zone properties](https://developers.arcgis.com/rest/services-reference/enterprise/query-feature-service-layer/#time-zone-properties) * @example * const layer = new FeatureLayer({ * // layer's fields definition * fields: [ * { * name: "ObjectID", * alias: "ObjectID", * type: "oid" * }, { * name: "type", * alias: "Type", * type: "string" * }, { * name: "recordedDate", * alias: "recordedDate", * type: "date" * }], * dateFieldsTimeZone: "America/New_York", // date field values in are eastern time zone * objectIdField: "ObjectID", // inferred from fields array if not specified * geometryType: "point", // geometryType and spatialReference are inferred from the first feature * // in the source array if they are not specified. * spatialReference: { wkid: 4326 }, * source: graphics // an array of graphics with geometry and attributes * }); * map.add(layer); */ accessor dateFieldsTimeZone: TimeZone | null | undefined; /** * This property is set by the service publisher and indicates that dates should be considered without the local timezone. * This applies to both requests and responses. * * > [!WARNING] * > * > **Known Limitations** * > * > - This capability is only available with services published with ArcGIS Enterprise 10.9 or greater. * > - Editing is not supported for FeatureLayers if `datesInUnknownTimezone` is true. The layer's [editingEnabled](https://developers.arcgis.com/javascript/latest/references/core/layers/FeatureLayer/#editingEnabled) property will be set to `false`. * > - When setting `timeExtent` in a [Query](https://developers.arcgis.com/javascript/latest/references/core/rest/support/Query/), the layer view's [filter.timeExtent](https://developers.arcgis.com/javascript/latest/references/core/views/layers/FeatureLayerView/#filter) or * > layer's [timeExtent](https://developers.arcgis.com/javascript/latest/references/core/layers/FeatureLayer/#timeExtent), dates must be defined in terms of UTC as illustrated in the code below. * > When using `layer.timeInfo.fullTimeExtent` in conjunction with [TimeSlider](https://developers.arcgis.com/javascript/latest/references/core/widgets/TimeSlider/), the local timezone offset must be removed. See the code snippet below. * * @default false * @since 4.21 * @see [ArcGIS REST API - New in 10.9](https://developers.arcgis.com/rest/services-reference/enterprise/layer-table/#new-in-109) * @see [What's new in ArcGIS Server](https://enterprise.arcgis.com/en/server/latest/get-started/windows/what-s-new-in-arcgis-for-server.htm) * @see [Edit map service settings](https://enterprise.arcgis.com/en/server/latest/publish-services/windows/edit-map-service-settings.htm#LI_A5825E4A9A3A42E991C662CD7B76A860) * @example * // Only download data for the year 2020. * // if the layer supports unknown time zone then create * // the dates in UTC * if (layer.datesInUnknownTimezone) { * layer.timeExtent = new TimeExtent({ * start: new Date(Date.UTC(2020, 0, 1)), * end: new Date(Date.UTC(2021, 0, 1)) * }); * } * else { * layer.timeExtent = new TimeExtent({ * start: new Date(2020, 0, 1), * end: new Date(2021, 0, 1) * }); * } * @example * // set up the timeslider for a service with an unknown timezone * if (layer.datesInUnknownTimezone) { * const timeSlider = new TimeSlider({ * view: view, * container: "timeSliderDiv", * timeVisible: true, * }); * view.ui.add(timeSlider, "bottom-left"); * * view.whenLayerView(layer).then((layerView) => { * // get the layer's fullTimeExtent and remove the local * // time zone offset * const timExtent = new TimeExtent({ * start: removeLocalOffset(layer.timeInfo.fullTimeExtent.start), * end: removeLocalOffset(layer.timeInfo.fullTimeExtent.end) * }); * * timeSlider.fullTimeExtent = timExtent; * timeSlider.stops = { * interval: layer.timeInfo.interval; * }; * }); * } * * // Remove the local time zone offset from dates * function removeLocalOffset(localTime) { * return new Date( * localTime.getUTCFullYear(), * localTime.getUTCMonth(), * localTime.getUTCDate(), * localTime.getUTCHours(), * localTime.getUTCMinutes(), * localTime.getUTCSeconds(), * localTime.getUTCMilliseconds() * ); * } */ get datesInUnknownTimezone(): boolean; /** * The SQL where clause used to filter features on the client. Only the features that satisfy the definition * expression are displayed in the [View](https://developers.arcgis.com/javascript/latest/references/core/views/View/). Setting a definition expression is useful * when the dataset is large and you don't want to bring all features to the client for analysis. * Definition expressions may be set when a layer is constructed prior to it loading in the view or * after it has been added to the map. If the definition expression is set after the layer has been added to the map, the view will * automatically refresh itself to display the features that satisfy the new definition expression. * * @example * // Set definition expression in constructor to only display trees with scientific name Ulmus pumila * const layer = new FeatureLayer({ * url: "https://services.arcgis.com/V6ZHFr6zdgNZuVG0/arcgis/rest/services/Landscape_Trees/FeatureServer/0", * definitionExpression: "Sci_Name = 'Ulmus pumila'" * }); * @example * // Set the definition expression directly on layer instance to only display trees taller than 50ft * layer.definitionExpression = "HEIGHT > 50"; */ accessor definitionExpression: string | null | undefined; /** The name of the layer's primary display field. The value of this property matches the name of one of the fields of the layer. */ accessor displayField: string | null | undefined; /** * The editor tracking fields, which record who adds or edits the data through the feature service * and when edits are made. */ get editFieldsInfo(): EditFieldsInfo | null | undefined; /** Specifies information about editing. */ get editingInfo(): EditingInfo | null | undefined; /** * Describes effective capabilities of the layer taking in to consideration privileges of the currently signed-in user. * * @since 4.26 */ get effectiveCapabilities(): FeatureLayerCapabilities | null | undefined; /** * Indicates whether the layer is editable taking in to consideration privileges of the * currently signed-in user. * * @since 4.26 */ get effectiveEditingEnabled(): boolean; /** * Specifies how features are placed on the vertical axis (z). This property may only be used * in a [SceneView](https://developers.arcgis.com/javascript/latest/references/core/views/SceneView/). See the [ElevationInfo sample](https://developers.arcgis.com/javascript/latest/sample-code/scene-elevationinfo/) * for an example of how this property may be used. * * > [!WARNING] * > * > If the elevation info is not specified, the effective elevation depends on the context and could vary per graphic. */ get elevationInfo(): ElevationInfo | null | undefined; set elevationInfo(value: ElevationInfoProperties | null | undefined); /** * A convenient property that can be used to make case-insensitive lookups for a field by name. * It can also provide a list of the [date fields](https://developers.arcgis.com/javascript/latest/references/core/layers/support/FieldsIndex/#dateFields) in a layer. * * @since 4.12 * @example * // lookup a field by name. name is case-insensitive * const field = layer.fieldsIndex.get("SoMeFiEld"); * * if (field) { * console.log(field.name); // SomeField * } */ get fieldsIndex(): FieldsIndex<Field>; /** * When a feature layer is configured as floor-aware, it has a floorInfo property defined. * A floor-aware layer is a layer that contains indoor GIS data representing features that * can be located on a specific floor of a building. * * @since 4.19 */ get floorInfo(): LayerFloorInfo | null | undefined; set floorInfo(value: LayerFloorInfoProperties | null | undefined); /** The full extent of the layer. */ get fullExtent(): Extent | null | undefined; set fullExtent(value: ExtentProperties | null | undefined); /** * The version of the geodatabase of the feature service data. Read * the [Overview of versioning](https://pro.arcgis.com/en/pro-app/latest/help/data/geodatabases/overview/overview-of-versioning-in-arcgis-pro.htm) topic for more details * about this capability. */ accessor gdbVersion: string | null | undefined; /** * Provides information on the system maintained area and length fields along with their respective units. * * @since 4.19 * @see [ArcGIS REST API documentation](https://developers.arcgis.com/rest/services-reference/layer-feature-service-.htm) */ get geometryFieldsInfo(): GeometryFieldsInfo | null | undefined; /** * The geometry type of features in the layer. All features must be of the same type. * This property is read-only when the layer is created from a [url](https://developers.arcgis.com/javascript/latest/references/core/layers/mixins/FeatureLayerBase/#url). * * When creating a FeatureLayer from [client-side features](https://developers.arcgis.com/javascript/latest/references/core/layers/mixins/FeatureLayerBase/#client-side), this property is * inferred by the geometryType of the features provided in the layer's [source](https://developers.arcgis.com/javascript/latest/references/core/layers/FeatureLayer/#source) * property. If the layer's [source](https://developers.arcgis.com/javascript/latest/references/core/layers/FeatureLayer/#source) is an empty array at the time of initialization, * this property must be set. * * @see [Add an array of client-side features](https://developers.arcgis.com/javascript/latest/references/core/layers/mixins/FeatureLayerBase/#client-side) */ accessor geometryType: "point" | "polygon" | "polyline" | "multipoint" | "multipatch" | "mesh"; /** * The name of a `gid` field containing a globally unique identifier for each * feature in the layer. This may be null or undefined if the layer does not have a * globally unique identifier field. * * @since 4.33 * @see [FeatureLayer.fields](https://developers.arcgis.com/javascript/latest/references/core/layers/FeatureLayer/#fields) */ accessor globalIdField: string | null | undefined; /** * Indicates whether the client-side features in the layer have `M` (measurement) values. * Use the `supportsM` property in the FeatureLayer's [capabilities.data](https://developers.arcgis.com/javascript/latest/references/core/layers/mixins/FeatureLayerBase/#capabilities) * object to verify if `M` values are supported on [feature service](https://developers.arcgis.com/rest/services-reference/feature-service.htm) features. */ accessor hasM: boolean; /** * Indicates whether the client-side features in the layer have `Z` (elevation) values. * Refer to [elevationInfo](https://developers.arcgis.com/javascript/latest/references/core/layers/mixins/FeatureLayerBase/#elevationInfo) for details regarding placement and rendering * of features with z-values in 3D [SceneViews](https://developers.arcgis.com/javascript/latest/references/core/views/SceneView/). * Use the `supportsZ` property in the FeatureLayer's [capabilities.data](https://developers.arcgis.com/javascript/latest/references/core/layers/mixins/FeatureLayerBase/#capabilities) * object to verify if `Z` values are supported on [feature service](https://developers.arcgis.com/rest/services-reference/feature-service.htm) features. */ accessor hasZ: boolean; /** * The historic moment to query. If historicMoment is not specified, the query * will apply to the current features. */ get historicMoment(): Date | null | undefined; set historicMoment(value: (Date | number | string) | null | undefined); /** * Returns `true` if the layer is loaded from a non-spatial table in a service. Non-spatial tables do not have * a spatial column that represent geographic features. * * @default false * @since 4.11 * @see [Map.tables](https://developers.arcgis.com/javascript/latest/references/core/Map/#tables) * @see [WebMap.tables](https://developers.arcgis.com/javascript/latest/references/core/WebMap/#tables) * @see [Map.allTables](https://developers.arcgis.com/javascript/latest/references/core/Map/#allTables) * @see [WebMap.allTables](https://developers.arcgis.com/javascript/latest/references/core/WebMap/#allTables) */ get isTable(): boolean; /** * The layer ID, or layer index, of a Feature Service layer. This is particularly useful when * loading a single feature layer with the [portalItem](https://developers.arcgis.com/javascript/latest/references/core/layers/FeatureLayer/#portalItem) property from a service containing * multiple layers. You can specify this value in one of two scenarios: * * * When loading the layer via the [portalItem](https://developers.arcgis.com/javascript/latest/references/core/layers/FeatureLayer/#portalItem) property. * * When pointing the layer's [url](https://developers.arcgis.com/javascript/latest/references/core/layers/mixins/FeatureLayerBase/#url) directly to a feature service. * * If a layerId is not specified in either of the above scenarios, then the first layer * in the service (`layerId = 0`) is selected. * * @example * // loads the third layer in the given Portal Item * const layer = new FeatureLayer({ * portalItem: { * id: "8d26f04f31f642b6828b7023b84c2188" * }, * layerId: 2 * }); * @example * // If not specified, the first layer (layerId: 0) will be returned * const layer = new FeatureLayer({ * portalItem: { * id: "8d26f04f31f642b6828b7023b84c2188" * } * }); * @example * // Can also be used if URL points to service and not layer * const layer = new FeatureLayer({ * // Notice that the url doesn't end with /2 * url: "http://services.arcgis.com/V6ZHFr6zdgNZuVG0/arcgis/rest/services/MonterreyBayCanyon_WFL/FeatureServer", * layerId: 2 * }); * @example * // This code returns the same layer as the previous snippet * const layer = new FeatureLayer({ * // The layer id is specified in the URL * url: "http://services.arcgis.com/V6ZHFr6zdgNZuVG0/arcgis/rest/services/MonterreyBayCanyon_WFL/FeatureServer/2", * }); */ accessor layerId: number; /** * The name of the object id [Field](https://developers.arcgis.com/javascript/latest/references/core/layers/support/Field/) containing a unique identifier for each feature in the layer. * The object id field for a [FeatureLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/FeatureLayer/) can contain either numeric or string values. * Some [feature layers](https://developers.arcgis.com/javascript/latest/references/core/layers/FeatureLayer/) use one or more [unique id fields](https://developers.arcgis.com/javascript/latest/references/core/layers/FeatureLayer/#uniqueIdFields) * to uniquely identify features. * Due to the complexity of object ids and unique ids, it is strongly recommended to use [Graphic.getObjectId()](https://developers.arcgis.com/javascript/latest/references/core/Graphic/#getObjectId) * method to obtain a feature's unique identifier. * * If this property is not defined when creating a [client-side feature layer](https://developers.arcgis.com/javascript/latest/references/core/layers/mixins/FeatureLayerBase/#client-side), * the object-id field will be automatically inferred from the layer's `fields` array. * * @see [Add an array of client-side features](https://developers.arcgis.com/javascript/latest/references/core/layers/mixins/FeatureLayerBase/#client-side) * @example * // See the sample snippet for the source and fields properties * const layer = new FeatureLayer({ * source: features, * fields: fields, * objectIdField: "ObjectID", // field name of the Object IDs * geometryType: "point", * renderer: <renderer> * }); */ accessor objectIdField: string; /** * The IANA time zone the author of the service intended data from date fields to be viewed in. * * @since 4.28 */ get preferredTimeZone(): TimeZone | null | undefined; /** * Array of [relationships](https://developers.arcgis.com/javascript/latest/references/core/layers/support/Relationship/) set up for the layer. Each object in the array describes the layer's * [Relationship](https://developers.arcgis.com/javascript/latest/references/core/layers/support/Relationship/) with another layer or table. * * @since 4.9 * @see [FeatureLayer.queryRelatedFeatures()](https://developers.arcgis.com/javascript/latest/references/core/layers/FeatureLayer/#queryRelatedFeatures) * @example * // print out layer's relationship length and each relationship info to console * layer.when(function () { * console.log("layer relationships", layer.relationships.length); * * layer.relationships.forEach(function (relationship) { * console.log("relationship id:", relationship.id) * console.log("relationship cardinality:", relationship.cardinality) * console.log("relationship key field:", relationship.keyField) * console.log("relationship name:", relationship.name) * console.log("relationship relatedTableId:", relationship.relatedTableId) * }); * }); */ get relationships(): Relationship[] | null | undefined; /** * When `true`, indicates that M values will be returned. When * `false`, indicates that M values will never be returned. The layer view * determines whether to include M values in feature queries when the * property value is `undefined`. */ accessor returnM: boolean | null | undefined; /** * When `true`, indicates that z-values will always be returned. When * `false`, indicates that z-values will never be returned. The layer view * determines whether to include z-values in feature queries when the * property value is `undefined`. */ accessor returnZ: boolean | null | undefined; /** * The service definition expression limits the features available for display and query. You can define additional filters on the layer in addition to the service definition expression * by setting layer's [definitionExpression](https://developers.arcgis.com/javascript/latest/references/core/layers/mixins/FeatureLayerBase/#definitionExpression). For example, if the service definition expression is set to display data where `"STATE_NAME = 'California'"` * you could use `definitionExpression` to only display a subset of the features in California, for example using `"COUNTY='San Diego'"`. * * @since 4.16 * @see [Set hosted feature layer view definition](https://doc.arcgis.com/en/arcgis-online/manage-data/set-view-definition.htm) */ get serviceDefinitionExpression(): string | null | undefined; /** * Indicates the portal item of the hosted feature service that contains this layer. * * @since 5.0 */ get serviceItemId(): string | null | undefined; /** * The [feature service's metadata JSON](https://developers.arcgis.com/rest/services-reference/layer-feature-service-.htm) * exposed by the ArcGIS REST API. While most commonly used properties * are exposed on the FeatureLayer class directly, this property gives access to all information returned * by the feature service. This property is useful if working in an application built using an older version of the API * which requires access to feature service properties from a more recent version. * * @since 4.13 */ accessor sourceJSON: Record<string, any> | null | undefined; /** * The spatial reference of the layer. When creating the layer from a * [url](https://developers.arcgis.com/javascript/latest/references/core/layers/mixins/FeatureLayerBase/#url), the spatial reference is read from the service. * * When creating a FeatureLayer from client-side features, this property is * inferred from the geometries of the features provided in the layer's [source](https://developers.arcgis.com/javascript/latest/references/core/layers/FeatureLayer/#source) * property. */ get spatialReference(): SpatialReference; set spatialReference(value: SpatialReferenceProperties); /** The name of the field which holds the id of the [subtypes](https://developers.arcgis.com/javascript/latest/references/core/layers/mixins/FeatureLayerBase/#subtypes). */ get subtypeField(): string; /** * An array of [subtypes](https://developers.arcgis.com/javascript/latest/references/core/layers/support/Subtype/) defined in the layer. * * @see [Introduction to subtypes](https://pro.arcgis.com/en/pro-app/latest/help/data/geodatabases/overview/an-overview-of-subtypes.htm) */ get subtypes(): Subtype[] | null | undefined; /** * The title of the layer used to identify it in places such as the [Legend](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-legend/) * and [LayerList](https://developers.arcgis.com/javascript/latest/references/core/widgets/LayerList/). * * When loading a layer by service url, the title is derived from the service name. * If the service has several layers, then the title of each layer will be the concatenation of the service name * and the layer name. * When the layer is loaded from a portal item, the title of the portal item will be used instead. * Finally, if a layer is loaded as part of a webmap or a webscene, then the title of the layer as stored in the webmap/webscene will be used. */ accessor title: string | null | undefined; /** * The absolute URL of the REST endpoint of the layer, non-spatial table or service. The URL may either point to a * resource on ArcGIS Enterprise or ArcGIS Online. * * If the url points directly to a service, then the layer must be specified in the * [layerId](https://developers.arcgis.com/javascript/latest/references/core/layers/mixins/FeatureLayerBase/#layerId) property. If no [layerId](https://developers.arcgis.com/javascript/latest/references/core/layers/mixins/FeatureLayerBase/#layerId) is given, then the first layer in the service will be loaded. * * @example * // Hosted Feature Service on ArcGIS Online * layer.url = "http://services.arcgis.com/V6ZHFr6zdgNZuVG0/arcgis/rest/services/origins/FeatureServer/0"; * @example * // Layer from Map Service on ArcGIS Server * layer.url = "http://sampleserver6.arcgisonline.com/arcgis/rest/services/Census/MapServer/2"; * @example * // Can also be used if URL points to service and not layer * const layer = new FeatureLayer({ * // Notice that the url doesn't end with /2 * url: "http://services.arcgis.com/V6ZHFr6zdgNZuVG0/arcgis/rest/services/MonterreyBayCanyon_WFL/FeatureServer", * layerId: 2 * }); * @example * // Non-spatial table in San Francisco incidents service. * const table = new FeatureLayer({ * url: "https://sampleserver6.arcgisonline.com/arcgis/rest/services/SF311/FeatureServer/1" * }); * // table must be loaded so it can be used in the app. * table.load().then(function() { * // table is loaded. ready to be queried. * }); */ accessor url: string | null | undefined; /** * The version of ArcGIS Server in which the layer is published. * * @example * // Prints the version number to the console - e.g. 10.91, 11.2, 11.3. * console.log(layer.version); */ get version(): number | null | undefined; /** * Returns the [Field](https://developers.arcgis.com/javascript/latest/references/core/layers/support/Field/) instance for a field name (case-insensitive). * * @param fieldName - Name of the field. * @returns the matching field or `undefined` * @since 4.11 * @see [FeatureLayer.fields](https://developers.arcgis.com/javascript/latest/references/core/layers/FeatureLayer/#fields) */ getField(fieldName: string): Field | null | undefined; /** * Returns the [Domain](https://developers.arcgis.com/javascript/latest/references/core/layers/support/Domain/) associated with the given field name. The domain can be either a * [CodedValueDomain](https://developers.arcgis.com/javascript/latest/references/core/layers/support/CodedValueDomain/) or [RangeDomain](https://developers.arcgis.com/javascript/latest/references/core/layers/support/RangeDomain/). * * @param fieldName - Name of the field. * @param options - An object specifying additional options. See the * object specification table below for the required properties of this object. * @returns The Domain object associated with the given field name for the given feature. * @example * // Get a range domain associated with the first feature * // returned from queryFeatures(). * layer.queryFeatures(query).then(function(results){ * const domain = layer.getFieldDomain("Height", {feature: results.features[0]}); * console.log("domain", domain) * }); */ getFieldDomain(fieldName: string, options?: FieldDomainOptions): DomainUnion | null | undefined; }