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.

Use dark colors for code blocksCopy
1
2
3
4
5
6
7
var a = [];
// an empty array with no elements;

Count(a); // returns 0

a = [5,2,19];
Count(a); // returns 3

A single array can contain elements of various types, but they cannot have missing elements.

Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
var z = [1,2,3];
var k = [1,2,"hello"];

return k[1];  // returns 2

z[0] = 23;  // z = [23,2,3]
z[3] = 24;  // Allowed as next sequential item
z[1000] = 23 // Not allowed

Arrays are zero-indexed, meaning the first element in the array is marked with an index of 0.

Use dark colors for code blocksCopy
1
2
3
4
var a = [10, 20, 30];

return a[0];
// returns 10;

You may iterate through the elements of an array using a for loop.

Use dark colors for code blocksCopy
1
2
3
for (var index in myArray){
  // executes for each element in the array
}

Note that the variable index represents the index of the array, not the value at that position.

Use dark colors for code blocksCopy
1
2
3
4
5
6
7
var myArray = [10,20,30,40,50,60,70];
var total = 0;
for(var index in myArray){
  total += myArray[index];
}
// total = 280
return total;

The following snippet sums the values of the array positions (or indexes):

Use dark colors for code blocksCopy
1
2
3
4
5
6
7
var myArray = [10,20,30,40,50,60,70];
var total = 0;
for(var index in myArray){
  total += index;
}
// total = 21
return total;

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. | | keywords | text | The keywords of the attachment.

Boolean

Boolean values evaluate to either true or false.

Use dark colors for code blocksCopy
1
2
3
var x = true;  // true
var y = false;  // false
var z = x && y;  // false

Date and time

Dates represent a moment in time. In Arcade, there are three date types:

Date

A Date represents a moment in time including year, month, day and time information. A date value is internally stored as a Unix Epoch, or the number of seconds since January 1, 1970 at 00:00:00 (i.e. 12 a.m.) UTC.

Dates include time zone or time offset information regardless of whether a time is specified in the date (since version 1.24). The time zone indicates the local time to a specific region. Arcade expressions are executed in a default time zone determined by the execution profile.

Dates are created with the Date() function.

Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
// Returns the current date and time
var a = Date();  // Creates a date representing Sep 9, 2023 14:33:29.391 EDT

// Date only defined, but displays time as midnight
var b = Date(2007,11,1);  // Creates a date representing Dec 1, 2007 00:00:00 EDT

// Pre-defined date/time
var c = Date(2008,11,1,12,55); // Creates a date representing Dec 1, 2008 12:55:00 EDT

Or input to expressions via profile variables.

Use dark colors for code blocksCopy
1
var d = $feature.creation_date;

Use the date functions to work with date objects, including getting their properties and creating new dates.

DateOnly

Since version 1.24

A DateOnly data type displays date information as a year, month, and day (i.e. "YYYY-MM-DD"). It is internally stored as the number of seconds from January 1, 1970 at 00:00:00 (i.e. 12 a.m.) UTC to the DateOnly value at 00:00:00 (i.e. 12 a.m.) UTC. It has neither time nor time zone information.

DateOnly values are created with the DateOnly() function.

Use dark colors for code blocksCopy
1
2
3
4
5
// Returns the current date
var a = DateOnly();  // "2023-09-12"

// Pre-defined date
var b = DateOnly(2007,11,1);  // "2007-12-01"

Time

Since version 1.24

A Time data type stores and displays time information as hours, minutes, seconds, and milliseconds (i.e. "hh:mm:ss"). It is internally stored as the number of milliseconds since the start of the day. It does not contain time zone information.

Time values are created with the Time() function.

Use dark colors for code blocksCopy
1
2
3
4
5
// Returns the current time
var a = Time();  // "14:40:01.398"

// Pre-defined time
var b = Time(6,30,0);  // "06:30:00"

Dictionary

A collection of key/value pairs. The keys of the dictionary are case insensitive. Dictionaries may be created with the Dictionary function.

Use dark colors for code blocksCopy
1
var d = Dictionary("field1", 1, "field2", 2);

You can also define dictionaries with curly brackets.

Use dark colors for code blocksCopy
1
2
3
4
5
var d = {
  field1: 1,
  field2: 2,
  "full name": "Fred Barker"
};

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.

Use dark colors for code blocksCopy
1
return d.field1 + d.field2;  // returns 3

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.

Use dark colors for code blocksCopy
1
return d["field1"] + d["field2"];  // returns 3

Square bracket notation allows you to access unconventional property names.

Use dark colors for code blocksCopy
1
2
d["full name"];
// returns "Fred Barker"

You can also use square brackets to reference dictionary keys using variable names.

Use dark colors for code blocksCopy
1
2
3
var y = 2000;
d["Population_" + y];
// returns population in the year 2000

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.

Use dark colors for code blocksCopy
1
2
var { field1, field2 } = d;
return field1 + field2;  // returns 3

Feature

Features represent geometries with a dictionary of attributes.

PropertyTypeDescription
attributesDictionaryA dictionary containing the attributes of the feature.
geometryGeometryThe geometry representing the location of the feature. This is optional.

You may access feature attributes using dot or square bracket notation.

Use dark colors for code blocksCopy
1
2
var d = Feature(myGeometry, "field1", 1, "field2", 2);
return d.field1 + d["field2"];  // returns 3

Many profiles contain a $feature profile variable, which represents an input feature to the expression.

Use dark colors for code blocksCopy
1
var population = $feature.Population;

You can reference values from joined tables using the square bracket syntax: $feature["joinKey.fieldName"]

Use dark colors for code blocksCopy
1
2
3
4
5
6
7
// returns % change in votes from 2012 to 2016
Round(
  (
    ($feature["COUNTY_ID.VOTED_DEM_2016"] - $feature["COUNTY_ID.VOTED_DEM_2012"])
    / $feature["COUNTY_ID.VOTED_DEM_2012"]
  ) * 100,
2 );

A feature's geometry cannot be accessed with dot notation. You must use the Geometry function to access a feature's geometry.

Use dark colors for code blocksCopy
1
2
3
4
var geom = Geometry($feature);
if( TypeOf(geom) == "Polygon" ){
  return firstVertex = geom.rings[0][0];  // The first vertex of the polygon
}

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.

Use dark colors for code blocksCopy
1
2
3
4
5
6
7
// Returns the highest population among all features in the layer
// $layer is a FeatureSet
var maxValue = Max($layer, "Population");
// $feature is a Feature
var value = $feature.Population;

return maxValue - value;

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.

Use dark colors for code blocksCopy
1
2
// publicLandFeatures represents the features in a layer named "public lands" in the map
var publicLandFeatures = FeatureSetByName($map, "public lands", ["class"], true);

Geometry

Arcade includes five geometry types:

Curve objects

Since version 1.25

A circular arc, an elliptic arc, and a cubic Bézier curve can be represented as a JSON curve object. A curve object is a segment in a Polyline or Polygon. It cannot be used as a stand-alone object. A curve object is given in a compact "curve to" manner with the first element representing the "to" point or end point. The "from" point is derived from the previous segment or curve object.

JSON curve object properties are defined in this document.

Client support for curve objects

Support for curve objects was introduced at Arcade 1.25 in the following clients:

  • ArcGIS Pro 3.3 and later
  • ArcGIS Maps SDKs for Native Apps 200.3 and later

Note that web clients, such as ArcGIS Online and the ArcGIS Maps SDK for JavaScript, currently do not support curve objects.

Spatial reference

All geometries have a spatial reference, which specifies the coordinate system and spatial properties for the coordinates defining the location of the geometry. This is defined as a dictionary with a wkid property that indicates the Well-known ID of the geographic or projected coordinate system. Read more about spatial references here.

Use dark colors for code blocksCopy
1
2
3
4
// General geometry creation. Will work out type from arguments.
var geom = Geometry({ x: 100, y: 100, spatialReference: { wkid: 102100 } })

return typeof(geom)  // returns "Point"

Geometries are immutable, meaning it is not possible to change a geometry after it has been created. Features have a geometry property, which can only be accessed with the Geometry() function.

Use dark colors for code blocksCopy
1
2
3
4
// Assigns the feature's geometry to the line variable
var line = Geometry($feature);

LengthGeodetic(line, "meters");  // returns the length of the line in meters

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.

PropertyTypeDescription
typetextIndicates the geometry type. This value is always Point.
xnumberThe x-coordinate of the point.
ynumberThe y-coordinate of the point.
znumberThe z-coordinate of the point. This may be null.
mnumberThe m value of the point. This may be null.
hasZbooleanIndicates if the geometry has a z-coordinate.
hasMbooleanIndicates if the geometry has an m-value.
spatialReferencedictionaryThe spatial reference of the geometry. This must match the spatial reference of the profile's execution context.
Use dark colors for code blocksCopy
1
2
3
4
5
var pt = Point({
  x: 100,
  y: 100,
  spatialReference: { wkid: 102100 }
});

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.

PropertyTypeDescription
typetextIndicates the geometry type. This value is always Multipoint.
pointsPoint[]An array of points making up the multipoint geometry.
hasZbooleanIndicates if the geometry has z-coordinates.
hasMbooleanIndicates if the geometry has m-values.
spatialReferencedictionaryThe spatial reference of the geometry. This must match the spatial reference of the profile's execution context.

The points property of a Multipoint may be defined with an array of x,y,z,m coordinates.

Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
var mp = Multipoint({
  points: [
    [-97.06138,32.837, 100],
    [-97.06133,32.836, 50],
    [-97.06124,32.834, 20],
    [-97.06127,32.832, 0]
  ],
  hasZ: true,
  spatialReference: { wkid: 102100 }
});

Or with an array of Point objects.

Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
var mp = Multipoint({
  points: [
    Point({ x: -97.06138, y: 32.837, z: 100, hasZ: true, spatialReference: { wkid: 102100 } }),
    Point({ x: -97.06133, y: 32.836, z: 50, hasZ: true, spatialReference: { wkid: 102100 } }),
    Point({ x: -97.06124, y: 32.834, z: 20, hasZ: true, spatialReference: { wkid: 102100 } }),
    Point({ x: -97.06127, y: 32.832, z: 0, hasZ: true, spatialReference: { wkid: 102100 } })
  ],
  hasZ: true,
  spatialReference: { wkid: 102100 }
});

Individual points within a Multipoint are returned as Point objects.

Use dark colors for code blocksCopy
1
2
3
// the x/y coordinates of the first point
var x = mp.points[0].x;
var y = mp.points[0].y;

Polyline

A polyline is a one-dimensional geometry consisting of paths, segments, and vertices. A vertex is a point defined along the line, typically creating an angle. A segment consists of a straight line defined as two points within a path. A path is a line comprised of one or more segments defined as an array of points. A polyline may have more than one path. 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.

PropertyTypeDescription
typetextIndicates the geometry type. This value is always Polyline.
pathsPoint[][]An array of paths (or lines) where each path is an array of Point objects representing line vertices, or a series of segments. You can create a Polyline by providing a 3-dimensional array of numbers where 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 path (or a line). The outer-most array defines an array of paths to include in the polyline.
hasZbooleanIndicates if the geometry has z-coordinates.
hasMbooleanIndicates if the geometry has m-values.
spatialReferencedictionaryThe spatial reference of the geometry. This must match the spatial reference of the profile's execution context.

The paths property of a Polyline may be defined with an array of x/y/z/m coordinates.

Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
// polyline with one path, which contains 4 vertices and 3 segments
// the third value in the vertex definition represents the z-value as indicated by the hasZ property
var line = Polyline({
  paths: [
    [  // path 0
      [-97.06138,32.837, 100],  // vertex 0; segment 0 start
      [-97.06133,32.836, 50],  // vertex 1; segment 0 end; segment 1 start
      [-97.06124,32.834, 20],  // vertex 2; segment 1 end; segment 2 start
      [-97.06127,32.832, 0]  // vertex 3; segment 2 end
    ]
  ],
  hasZ: true,
  spatialReference: { wkid: 102100 }
});
Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// polyline with two paths, each with 4 vertices and 3 segments
// the third value in the vertex definition represents the m-value as indicated by the hasM property
var line = Polyline({
  paths: [
    [ // path 0
      [-97.06138,32.837, 0],  // vertex 0; segment 0 start
      [-97.06133,32.836, 10],  // vertex 1; segment 0 end; segment 1 start
      [-97.06124,32.834, 20],  // vertex 2; segment 1 end; segment 2 start
      [-97.06127,32.832, 30]  // vertex 3; segment 2 end
    ], [ // path 1
      [-101.06138,32.837, 50],  // vertex 0; segment 0 start
      [-101.06133,32.836, 60],  // vertex 1; segment 0 end; segment 1 start
      [-101.06124,32.834, 70],  // vertex 2; segment 1 end; segment 2 start
      [-101.06127,32.832, 80]  // vertex 3; segment 2 end
    ]
  ],
  hasM: true,
  spatialReference: { wkid: 102100 }
});

Or with an array of Point objects.

Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
11
12
// polyline with one path, which contains 4 vertices and 3 segments
// the third value in the vertex definition represents the z-value as indicated by the hasZ property
var line = Polyline({
  paths: [[
    Point({ x: -97.06138, y: 32.837, z: 100, hasZ: true, spatialReference: { wkid: 102100 } }),
    Point({ x: -97.06133, y: 32.836, z: 50, hasZ: true, spatialReference: { wkid: 102100 } }),
    Point({ x: -97.06124, y: 32.834, z: 20, hasZ: true, spatialReference: { wkid: 102100 } }),
    Point({ x: -97.06127, y: 32.832, z: 0, hasZ: true, spatialReference: { wkid: 102100 } })
  ]],
  hasZ: true,
  spatialReference: { wkid: 102100 }
});
Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// polyline with two paths, each with 4 vertices and 3 segments
// the third value in the vertex definition represents the z-value as indicated by the hasZ property
var line = Polyline({
  paths: [
    [
      Point({ x: -97.06138, y: 32.837, z: 100, hasZ: true, spatialReference: { wkid: 102100 } }),
      Point({ x: -97.06133, y: 32.836, z: 50, hasZ: true, spatialReference: { wkid: 102100 } }),
      Point({ x: -97.06124, y: 32.834, z: 20, hasZ: true, spatialReference: { wkid: 102100 } }),
      Point({ x: -97.06127, y: 32.832, z: 0, hasZ: true, spatialReference: { wkid: 102100 } })
    ], [
      Point({ x: -101.06138, y: 32.837, z: 100, hasZ: true, spatialReference: { wkid: 102100 } }),
      Point({ x: -101.06133, y: 32.836, z: 50, hasZ: true, spatialReference: { wkid: 102100 } }),
      Point({ x: -101.06124, y: 32.834, z: 20, hasZ: true, spatialReference: { wkid: 102100 } }),
      Point({ x: -101.06127, y: 32.832, z: 0, hasZ: true, spatialReference: { wkid: 102100 } })
    ]
  ],
  hasZ: true,
  spatialReference: { wkid: 102100 }
});

Individual vertices within a Polyline are returned as Point objects.

Use dark colors for code blocksCopy
1
2
3
// the x/y coordinates of the first vertex of the first path in the polyline
var x = line.paths[0][0].x;
var y = line.paths[0][0].y;

Polyline with curves

Since version 1.25

Some clients support defining polylines with curve objects. Curve objects may only be referenced in the curvePaths property of a Polyline. The properties for defining a Polyline with curves are as follows:

PropertyTypeDescription
typetextIndicates the geometry type. This value is always Polyline.
curvePathsArray<Point | Curve>An array of paths (or line segments) that may contain curves.
hasZbooleanIndicates if the geometry has z-coordinates.
hasMbooleanIndicates if the geometry has m-values.
spatialReferencedictionaryThe spatial reference of the geometry. This must match the spatial reference of the profile's execution context.

See the Polyline with curves documentation for more information and examples.

Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
// A polyline consisting of a line segment from (3.5, 0) to (3.5, 1) and a
// clockwise circle starting and ending at (3.5, 1) with center point (3, 2)

Polyline({
  type: "Polyline",
  curvePaths:
  [
    [
      [3.5, 0],
      [3.5, 1],
      {"a": [[3.5, 1], [3, 2], 0, 1]}
    ]
  ]
})

Polygon

A polygon is a two-dimensional geometry consisting of rings (or boundaries), segments, and vertices. A vertex is a point defined along the polygon edge, typically creating an angle. A segment consists of a straight line defined as two points within a ring. A ring is a line comprised of one or more segments defined as an array of points. A polygon may have more than one ring. 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.

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.

PropertyTypeDescription
typetextIndicates the geometry type. This value is always Polygon.
ringsPoint[][]An array of rings where each ring is an array of Point objects representing polygon vertices. You can create a Polygon by providing a 3-dimensional array of numbers where 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 an array of rings to include in the polygon. Rings must defined in clockwise order to create a polygon. Rings defined in counter-clockwise order define holes in the polygon.
hasZbooleanIndicates if the geometry has z-coordinates.
hasMbooleanIndicates if the geometry has m-values.
spatialReferencedictionaryThe spatial reference of the geometry. This must match the spatial reference of the profile's execution context.

The rings property of a Polygon may be defined with an array of x/y/z/m coordinates.

Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
// polygon with one ring, which contains 4 vertices and 4 segments
// the third value in the vertex definition represents the z-value as indicated by the hasZ property
var shape = Polygon({
  rings: [
    [  // ring 0
      [-97.06138,32.837, 100],  // vertex 0; segment 0 start
      [-97.06133,32.836, 50],  // vertex 1; segment 0 end; segment 1 start
      [-97.06124,32.834, 20],  // vertex 2; segment 1 end; segment 2 start
      [-97.06127,32.832, 0]  // vertex 3; segment 2 end; segment 3 start
      [-97.06138,32.837, 100],  // vertex 4 (same as vertex 0); segment 3 end
    ]
  ],
  hasZ: true,
  spatialReference: { wkid: 102100 }
});
Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// polygon with two rings, each with 4 vertices and 4 segments
// the third value in the vertex definition represents the m-value as indicated by the hasM property
var shape = Polygon({
  rings: [
    [  // ring 0
      [-97.06138,32.837, 0],  // vertex 0; segment 0 start
      [-97.06133,32.836, 10],  // vertex 1; segment 0 end; segment 1 start
      [-97.06124,32.834, 20],  // vertex 2; segment 1 end; segment 2 start
      [-97.06127,32.832, 30]  // vertex 3; segment 2 end; segment 3 start
      [-97.06138,32.837, 0],  // vertex 4 (same as vertex 0); segment 3 end
    ], [  // ring 1
      [-101.06138,32.837, 40],  // vertex 0; segment 0 start
      [-101.06133,32.836, 50],  // vertex 1; segment 0 end; segment 1 start
      [-101.06124,32.834, 60],  // vertex 2; segment 1 end; segment 2 start
      [-101.06127,32.832, 70]  // vertex 3; segment 2 end; segment 3 start
      [-101.06138,32.837, 40],  // vertex 4 (same as vertex 0); segment 3 end
    ]
  ],
  hasM: true,
  spatialReference: { wkid: 102100 }
});

Or with an array of Point objects.

Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
11
12
13
// polygon with one ring, which contains 4 vertices and 4 segments
// the third value in the vertex definition represents the z-value as indicated by the hasZ property
var shape = Polygon({
  rings: [[  // ring 0
    Point({ x: -97.06138, y: 32.837, z: 100, hasZ: true, spatialReference: { wkid: 102100 } }),
    Point({ x: -97.06133, y: 32.836, z: 50, hasZ: true, spatialReference: { wkid: 102100 } }),
    Point({ x: -97.06124, y: 32.834, z: 20, hasZ: true, spatialReference: { wkid: 102100 } }),
    Point({ x: -97.06127, y: 32.832, z: 0, hasZ: true, spatialReference: { wkid: 102100 } }),
    Point({ x: -97.06138, y: 32.837, z: 100, hasZ: true, spatialReference: { wkid: 102100 } })
  ]],
  hasZ: true,
  spatialReference: { wkid: 102100 }
});
Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// polygon with two rings, each with 4 vertices and 4 segments
// the third value in the vertex definition represents the m-value as indicated by the hasM property
var shape = Polygon({
  rings: [
    [  // ring 0
      Point({ x: -97.06138, y: 32.837, m: 0, hasM: true, spatialReference: { wkid: 102100 } }),
      Point({ x: -97.06133, y: 32.836, m: 10, hasM: true, spatialReference: { wkid: 102100 } }),
      Point({ x: -97.06124, y: 32.834, m: 20, hasM: true, spatialReference: { wkid: 102100 } }),
      Point({ x: -97.06127, y: 32.832, m: 30, hasM: true, spatialReference: { wkid: 102100 } }),
      Point({ x: -97.06138, y: 32.837, m: 0, hasM: true, spatialReference: { wkid: 102100 } })
    ], [  // ring 1
      Point({ x: -101.06138, y: 32.837, m: 40, hasM: true, spatialReference: { wkid: 102100 } }),
      Point({ x: -101.06133, y: 32.836, m: 50, hasM: true, spatialReference: { wkid: 102100 } }),
      Point({ x: -101.06124, y: 32.834, m: 60, hasM: true, spatialReference: { wkid: 102100 } }),
      Point({ x: -101.06127, y: 32.832, m: 70, hasM: true, spatialReference: { wkid: 102100 } }),
      Point({ x: -101.06138, y: 32.837, m: 40, hasM: true, spatialReference: { wkid: 102100 } })
    ]
  ],
  hasM: true,
  spatialReference: { wkid: 102100 }
});

Individual vertices within a Polygon are returned as Point objects.

Use dark colors for code blocksCopy
1
2
3
// the x/y coordinates of the first ring in the polygon
var x = shape.rings[0][0].x;
var y = shape.rings[0][0].y;

Polygon with curves

Since version 1.25

Some clients support defining polygons with curve objects. Curve objects may only be referenced in the curveRings property of a Polygon. The properties for defining a Polygon with curves are as follows:

PropertyTypeDescription
typetextIndicates the geometry type. This value is always Polygon.
curveRingsArray<Point | Curve>An array of vertices or curve objects in a ring. All rings should be closed, meaning the first vertex of each ring should always be the same as the last vertex. Vertices should be defined in clockwise order. Rings with vertices defined in counter-clockwise order will result in polygon holes. Each item in the array can be either a vertex or a curve object.
hasZbooleanIndicates if the geometry has z-coordinates.
hasMbooleanIndicates if the geometry has m-values.
spatialReferencedictionaryThe spatial reference of the geometry. This must match the spatial reference of the profile's execution context.

See the Polygon with curves documentation for more information and examples.

Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// A multipart polygon with m-values containing a triangle with start/end point (11, 11),
// a Bézier curve from (11, 11) to (15, 15) with control points (10, 17) and (18, 20), and
// a circular arc from (15, 15) to (20, 16) through (20, 14)

Polygon({
  hasM: true,
  curveRings:
  [
    [
      [11, 11, 1],
      [10, 10, 2],
      [10, 11, 3],
      [11, 11, 4],
      {"b": [[15, 15, 2], [10, 17], [18, 20]]},
      [11, 11, 4]
    ],
    [
      [15, 15, 1],
      {"c": [[20, 16, 3], [20, 14]]},
      [15, 15, 3]
    ]
  ]
})

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.

PropertyTypeDescription
typetextIndicates the geometry type. This value is always Extent.
xMaxnumberThe upper bound, or highest possible x-coordinate of the geometry.
xMinnumberThe lower bound, or lowest possible x-coordinate of the geometry.
yMaxnumberThe upper bound, or highest possible y-coordinate of the geometry.
yMinnumberThe lower bound, or lowest possible y-coordinate of the geometry.
zMaxnumberThe upper bound, or highest possible z-coordinate of the geometry. This value may be null.
zMinnumberThe lower bound, or lowest possible z-coordinate of the geometry. This value may be null.
mMaxnumberThe upper bound, or highest possible m-value of the geometry. This value may be null.
mMinnumberThe lower bound, or lowest possible m-value of the geometry. This value may be null.
hasZbooleanIndicates if the geometry has z-coordinates.
hasMbooleanIndicates if the geometry has m-values.
spatialReferencedictionaryThe spatial reference of the geometry. This must match the spatial reference of the profile's execution context.
Use dark colors for code blocksCopy
1
2
3
4
5
6
7
var envelope = Extent({
  xmin: -109.55,
  ymin: 25.76,
  xmax: -86.39,
  ymax: 49.94,
  spatialReference: { wkid: 102100 }
});

KnowledgeGraph

Since version 1.26

A knowledge graph represents a graph database that stores entities and relationships and their associated properties.

To learn more, check out the following resources:

Number

A number represents a count or amount that can be used used in computations and Math functions.

They can be integers.

Use dark colors for code blocksCopy
1
2
var x = 10;
var y = 100;

Or floating point values.

Use dark colors for code blocksCopy
1
2
var z = 1.2;
var aa = 0.0034;

Notation types

Numbers can be defined in several ways.

Decimal exponential

Decimal exponential notation defines a number as a decimal value, followed by a Latin letter E, followed by an exponent. This indicates to multiply the decimal number by 10^x power where the number x following e represents the exponent.

Use dark colors for code blocksCopy
1
2
3
var dd = 0.255e3;  // 255

0.255e3 == 0.255 * Pow(10,3);  // true

Binary

Binary numbers are always preceded with a zero followed by a Latin letter B (e.g. 0b). Digits that follow these characters must be either 0 or 1.

Use dark colors for code blocksCopy
1
var cc = 0b11111111;  // 255

Octal

Octal numbers are always preceded with a zero followed by a Latin letter O (e.g. 0o). Digits that follow these characters must be a number between 0-7.

Use dark colors for code blocksCopy
1
var ee = 0o755;  // 493

Hexadecimal

Hexadecimal numbers are always preceded with a zero followed by a Latin letter X (e.g. 0x). Digits that follow these characters must be in the range 0123456789ABCDEF.

Use dark colors for code blocksCopy
1
var bb = 0xff;  // 255

The maximum possible number in Arcade is 2^1024 or 1.7976931348623157e+308.

Arcade provides two number constants:

Use dark colors for code blocksCopy
1
var circleArea = PI * Pow($feature.radius, 2);

Portal

Since version 1.8

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.

Use dark colors for code blocksCopy
1
2
3
4
5
// Represents the ArcGIS Online portal instance
var agol = Portal("https://www.arcgis.com");

// references a layer with its ID from a specified portal instance
var layer = FeatureSetByPortalItem(agol, "7b1fb95ab77f40bf8aa09c8b59045449", 0, ["*"], false);

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.

Use dark colors for code blocksCopy
1
2
3
4
5
var x = "This is a Text variable";
var z = 'This is also a text variable';

// n = "100"
var n = Text(100);

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.

As of version 1.11, you can embed expressions in text using template literals.

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.