Skip to content
import DataLayer from "@arcgis/core/rest/support/DataLayer.js";
Inheritance:
DataLayerAccessor
Since
ArcGIS Maps SDK for JavaScript 4.20

Input for properties of ClosestFacilityParameters, RouteParameters or ServiceAreaParameters. The DataLayer can be used to define the following for each parameter type:

Constructors

Constructor

Constructor
Parameters
ParameterTypeDescriptionRequired
properties
See the properties table for a list of all the properties that may be passed into the constructor.

Properties

Any properties can be set, retrieved or listened to. See the Watch for changes topic.

declaredClass

readonlyinherited Property
Type
string
Inherited from: Accessor

The name of the class. The declared class name is formatted as esri.folder.className.

doNotLocateOnRestrictedElements

Property
Type
boolean | null | undefined
Since
ArcGIS Maps SDK for JavaScript 4.21

If true, restricted network elements should be considered when finding network locations.

geometry

autocast Property
Type
GeometryUnion | null | undefined

The geometry to apply to the spatial filter. The spatial relationship as specified by spatialRelationship is applied to this geometry while performing the query.

Example
let stops = new DataLayer();
stops.geometry = view.extent;

geometryType

Property
Type
GeometryType | null | undefined
Since
ArcGIS Maps SDK for JavaScript 4.24

The type of geometry specified by the geometry property.

name

Property
Type
string | null | undefined

The name of the data layer in the map service that is being referenced.

Example
let stops = new DataLayer();
stops.name = "Hospitals";

spatialRelationship

Property
Type
Exclude<SpatialRelationship, "disjoint"> | null | undefined

The spatial relationship to be applied on the input geometry while performing the query.

Possible ValueDescription
intersectsPart of a feature from feature class 1 is contained in a feature from feature class 2.
containsPart or all of a feature from feature class 1 is contained within a feature from feature class 2.
crossesThe feature from feature class 1 crosses a feature from feature class 2.
envelope-intersectsThe envelope of feature class 1 intersects with the envelope of feature class 2.
index-intersectsThe envelope of the query feature class intersects the index entry for the target feature class.
overlapsFeatures from feature class 1 overlap features in feature class 2.
touchesThe feature from feature class 1 touches the border of a feature from feature class 2.
withinThe feature from feature class 1 is completely enclosed by the feature from feature class 2.
relationAllows specification of any relationship defined using the Shape Comparison Language.
Example
let stops = new DataLayer();
stops.spatialRelationship = "contains";

type

readonly Property
Type
"layer"

where

Property
Type
string | null | undefined

A where clause for the query. Any legal SQL where clause operating on the fields in the layer is allowed.

Example
let stops = new DataLayer();
stops.where = "POP2000 > 350000";

Methods

MethodSignatureClass
fromJSON
inherited static
fromJSON(json: any): any
clone
inherited
clone(): this
toJSON
inherited
toJSON(): any

fromJSON

inheritedstatic Method
Signature
fromJSON (json: any): any
Inherited from: JSONSupportMixin

Creates a new instance of this class and initializes it with values from a JSON object generated from an ArcGIS product. The object passed into the input json parameter often comes from a response to a query operation in the REST API or a toJSON() method from another ArcGIS product. See the Using fromJSON() topic in the Guide for details and examples of when and how to use this function.

Parameters
ParameterTypeDescriptionRequired
json
any

A JSON representation of the instance in the ArcGIS format. See the ArcGIS REST API documentation for examples of the structure of various input JSON objects.

Returns
any

Returns a new instance of this class.

clone

inherited Method
Signature
clone (): this
Inherited from: ClonableMixin

Creates a deep clone of this object. Any properties that store values by reference will be assigned copies of the referenced values on the cloned instance.

Returns
this

A deep clone of the class instance that invoked this method.

toJSON

inherited Method
Signature
toJSON (): any
Inherited from: JSONSupportMixin

Converts an instance of this class to its ArcGIS portal JSON representation. See the Using fromJSON() guide topic for more information.

Returns
any

The ArcGIS portal JSON representation of an instance of this class.