Data Types
Arcade has a full type system. Each type is described below.
Any
Represents any type described below. Some Arcade functions, such as Array, accept values of any type. A function may also return a value of any type depending on its inputs. In these cases, you may see function parameters and return types documented as Any
.
Array
An object representing a list of elements. Arrays are declared using square brackets.
A single array can contain elements of various types, but they cannot have missing elements.
Arrays are zero-indexed, meaning the first element in the array is marked with an index of 0.
You may iterate through the elements of an array using a for loop.
Note that the variable index
represents the index of the array, not the value at that position.
The following snippet sums the values of the array positions (or indexes):
Attachment
Defines information about attachments returned from feature service queries. These are fetched using the Attachments() function.
Property | Type | Description |
---|---|---|
id | number | The ID of the attachment. |
name | text | The file name of the attachment, including the file extension. |
contentType | text | The content type of the attachment. The following are supported types: bmp, ecw, emf, eps, ps, gif, img, jp2, jpc, j2k, jpf, jpg, jpeg, jpe, png, psd, raw, sid, tif, tiff, wmf, wps, avi, mpg, mpe, mpeg, mov, wmv, aif, mid, rmi, mp2, mp3, mp4, pma, mpv2, qt, ra, ram, wav, wma, doc, docx, dot, xls, xlsx, xlt, pdf, ppt, pptx, txt, zip, 7z, gz, gtar, tar, tgz, vrml, gml, json, xml, mdb, geodatabase . |
size | number | The size of the attachment in bytes. |
exifInfo | Array | An array containing the Exif metadata of the attachment. |
Boolean
Boolean values evaluate to either true
or false
.
Date
Dates represent a moment in time. Dates are created with the Date() function and are stored as a Unix Epoch.
Use the date functions to work with date objects, including getting its properties and calculating new dates.
Dictionary
A collection of key/value pairs. The keys of the dictionary are case insensitive. Dictionaries may be created with the Dictionary function.
You can also define dictionaries with curly brackets.
Dot notation
Dictionary properties can be of any type, including Dictionary. Properties can be accessed with dot notation. Dot notation allows you to access property values by typing the name of the dictionary, followed by a dot, and followed by the name of the dictionary property.
Dot notation is not supported if the property name contains spaces or non-Latin characters outside the Unicode BMP. In these scenarios you need square bracket notation.
Square bracket notation
Square bracket notation allows you to access dictionary properties by wrapping the property name as a text value inside of square brackets.
Square bracket notation allows you to access unconventional property names.
You can also use square brackets to reference dictionary keys using variable names.
Auto-keys
You may access dictionary properties using auto-keys. Auto-keys assign dictionary key values to Arcade variables with names matching the dictionary's keys.
Feature
Features represent geometries with a dictionary of attributes.
Property | Type | Description |
---|---|---|
attributes | Dictionary | A dictionary containing the attributes of the feature. |
geometry | Geometry | The geometry representing the location of the feature. This is optional. |
You may access feature attributes using dot or square bracket notation.
Many profiles contain a $feature
profile variable, which represents an input feature to the expression.
You can reference values from joined tables using the square bracket syntax: $feature["join
A feature's geometry cannot be accessed with dot notation. You must use the Geometry function to access a feature's geometry.
FeatureSet
A FeatureSet represents a connection to a layer in memory or in a server. FeatureSets are lazy, iterable, and chain-able. They allow you to access features from tables and layers within a map, feature service, or database using a FeatureSet function.
FeatureSets are typically provided to Arcade scripts via a profile variable, such as $layer
, or as part of a FeatureSetCollection like $map
or $datastore
.
See the FeatureSet guide guide to learn about creating and working with FeatureSets.
FeatureSetCollection
A FeatureSetCollection represents a collection of FeatureSets. This data type is only used when working with the $map
and $datastore
profile variables available in some profiles, like Popup. For example, the $map
profile variable represents a collection of layers (i.e. FeatureSets) in the map of the $feature
used in the execution of the Arcade expression. The $datastore
represents a collection of layers in the same feature service as the $feature
used in the execution of the Arcade expression.
Geometry
Arcade includes five geometry types:
Geometry is immutable, meaning it is not possible to change after it has been created. Features have a geometry property, which can only be accessed with the Geometry() function.
The following tables describe the specification of each geometry type.
Point
A point is a zero-dimensional geometry representing a location with a pair of coordinates. This may be created by providing a Dictionary defined with the properties below to the Point() function or by passing a point feature to the Geometry() function.
Property | Type | Description |
---|---|---|
type | text | Indicates the geometry type. This value is always point . |
x | number | The x-coordinate of the point. |
y | number | The y-coordinate of the point. |
z | number | The z-coordinate of the point. This may be null . |
m | number | The m value of the point. This may be null . |
hasZ | boolean | Indicates if the geometry has a z-coordinate. |
hasM | boolean | Indicates if the geometry has an m-value. |
spatialReference | dictionary | The spatial reference of the geometry. This object contains a wkid property that indicates the Well-known ID of the geographic or projected coordinate system that defines the reference for which to draw the geometry. |
Multipoint
A multipoint is a zero-dimensional geometry, where multiple points represent one geometry. This may be created by providing a Dictionary defined with the properties below to the Multipoint() function or by passing a multipoint feature to the Geometry() function.
Property | Type | Description |
---|---|---|
type | text | Indicates the geometry type. This value is always multipoint . |
points | Point[] | number[][] | An array of points making up the multipoint geometry. |
hasZ | boolean | Indicates if the geometry has z-coordinates. |
hasM | boolean | Indicates if the geometry has m-values. |
spatialReference | dictionary | The spatial reference of the geometry. This object contains a wkid property that indicates the Well-known ID of the geographic or projected coordinate system that defines the reference for which to draw the geometry. |
The points
property of a Multipoint may be defined with an array of x,y,z,m coordinates.
Or with an array of Point objects.
Polyline
A polyline is a one-dimensional geometry containing a list of coordinates representing one or more paths. This may be created by providing a Dictionary defined with the properties below to the Polyline() function or by passing a polyline feature to the Geometry() function.
Property | Type | Description |
---|---|---|
type | text | Indicates the geometry type. This value is always polyline . |
paths | number[][][] | Point[][] | A three-dimensional array of numbers representing coordinates or a two-dimensional array of points. When providing an 3-dimensional array of numbers, the inner-most array contains the coordinates of a single point (or vertex). This array must have at least 2 elements that represent x,y coordinates, but it may have up to 4 representing x,y,z,m values. The middle array contains additional points making up a line segment (or path). The outer-most array defines a list of segments to include in the polyline. |
hasZ | boolean | Indicates if the geometry has z-coordinates. |
hasM | boolean | Indicates if the geometry has m-values. |
spatialReference | dictionary | The spatial reference of the geometry. This object contains a wkid property that indicates the Well-known ID of the geographic or projected coordinate system that defines the reference for which to draw the geometry. |
The paths
property of a Polyline may be defined with an array of x/y/z/m coordinates.
Or with an array of Point objects.
Polygon
A polygon is a two-dimensional geometry containing a list of coordinates representing one or more rings (or boundaries) in a polygon. This may be created by providing a Dictionary defined with the properties below to the Polygon() function or by passing a polygon feature to the Geometry() function.
Property | Type | Description |
---|---|---|
type | text | Indicates the geometry type. This value is always polygon . |
rings | number[][][] | Point[][] | A three-dimensional array of numbers or a two-dimensional array of points. When providing an 3-dimensional array of numbers, the inner-most array contains the coordinates of a single point. This array must have at least 2 elements that represent x,y coordinates, but it may have up to 4 representing x,y,z,m values. The middle array contains additional points making up a ring whose first and last points must match. The outer-most array defines a list of rings to include in the polygon. |
hasZ | boolean | Indicates if the geometry has z-coordinates. |
hasM | boolean | Indicates if the geometry has m-values. |
spatialReference | dictionary | The spatial reference of the geometry. This object contains a wkid property that indicates the Well-known ID of the geographic or projected coordinate system that defines the reference for which to draw the geometry. |
The rings
property of a Polygon may be defined with an array of x/y/z/m coordinates.
Or with an array of Point objects.
Polygons with holes must be defined with an outer ring whose points are listed in clockwise order. The hole, or inner ring, must define its points in counter-clockwise order.
Extent
An extent is a bounding box describing the minimum and maximum coordinates of a polygon, polyline, multipoint. This may be created by providing a Dictionary defined with the properties below to the Extent() function or by passing an extent feature to the Geometry() function.
Property | Type | Description |
---|---|---|
type | text | Indicates the geometry type. This value is always extent . |
xMax | number | The upper bound, or highest possible x-coordinate of the geometry. |
xMin | number | The lower bound, or lowest possible x-coordinate of the geometry. |
yMax | number | The upper bound, or highest possible y-coordinate of the geometry. |
yMin | number | The lower bound, or lowest possible y-coordinate of the geometry. |
zMax | number | The upper bound, or highest possible z-coordinate of the geometry. This value may be null . |
zMin | number | The lower bound, or lowest possible z-coordinate of the geometry. This value may be null . |
mMax | number | The upper bound, or highest possible m-value of the geometry. This value may be null . |
mMin | number | The lower bound, or lowest possible m-value of the geometry. This value may be null . |
hasZ | boolean | Indicates if the geometry has z-coordinates. |
hasM | boolean | Indicates if the geometry has m-values. |
spatialReference | dictionary | The spatial reference of the geometry. This object contains a wkid property that indicates the Well-known ID of the geographic or projected coordinate system that defines the reference for which to draw the geometry. |
Number
A number represents a count or amount that can be used used in computations and Math functions.
They can be integers.
Or floating point values.
Arcade provides two number constants:
Numbers are limited in size to double max.
Portal
The Portal type represents an instance of an ArcGIS Portal (e.g. ArcGIS Online or ArcGIS Enterprise portal). This type is created by passing the URL of the portal instance to the Portal() function.
This type only applies to the portal
parameter of the FeatureSetByPortalItem() function.
Text
A text value is a series of characters wrapped in single or double quotes. Any number, date, dictionary, or boolean value may be converted to a text value using the Text() function.
Several text constants are available for your convenience. These allow you to insert special characters in text without needing to use escape characters. Click the links below to see the documentation for each.
- TextFormatting.BackwardSlash
- TextFormatting.DoubleQuote
- TextFormatting.ForwardSlash
- TextFormatting.NewLine
- TextFormatting.SingleQuote
As of version 1.11, you can embed expressions in text using template literals.