require(["esri/geometry/Polygon"], (Polygon) => { /* code goes here */ });
import Polygon from "@arcgis/core/geometry/Polygon.js";
esri/geometry/Polygon
A polygon contains an array of rings and a spatialReference. Each ring is represented as an array of points. The first and last points of a ring must be the same. A polygon also has booleanvalued hasM and hasZ fields.
Known Limitations
The polygon geometries must be simple when added to the following layers:
 View.graphics
 GraphicsLayer
 Feature collections added through FeatureLayer.source
Polygon geometries can be inspected and simplified before they are added to those layers. Use the geometryEngine's simplify() method to make sure that polygons display correctly on the clientside.
Constructors

Parameterproperties Objectoptional
See the properties for a list of all the properties that may be passed into the constructor.
Property Overview
Name  Type  Summary  Class 

Object  The cache is used to store values computed from geometries that need to be cleared or recomputed upon mutation.  Geometry  
Point  The centroid of the polygon.  Polygon  
String  The name of the class.  Accessor  
Extent  The extent of the geometry.  Geometry  
Boolean  Indicates if the geometry has M values.  Geometry  
Boolean  Indicates if the geometry has zvalues (elevation).  Geometry  
Boolean  Checks to see if polygon rings cross each other and indicates if the polygon is selfintersecting, which means the ring of the polygon crosses itself.  Polygon  
Number[][][]  An array of rings.  Polygon  
SpatialReference  The spatial reference of the geometry.  Geometry  
String  The string value representing the type of geometry.  Polygon 
Property Details

centroid
centroid Point

The centroid of the polygon. For a polygon with multiple rings, it represents the centroid of the largest ring.

hasZ
InheritedPropertyhasZ Boolean
Inherited from Geometry 
Indicates if the geometry has zvalues (elevation).
Zvalues defined in a geographic or metric coordinate system are expressed in meters. However, in local scenes that use a projected coordinate system, vertical units are assumed to be the same as the horizontal units specified by the service.

isSelfIntersecting
isSelfIntersecting Boolean

Checks to see if polygon rings cross each other and indicates if the polygon is selfintersecting, which means the ring of the polygon crosses itself.

An array of rings. Each ring is a twodimensional array of numbers representing the coordinates of each vertex in the ring in the spatial reference of the view. The first vertex of each ring should always be the same as the last vertex. Each vertex is an array of two, three, or four numbers. The table below shows the various structures of a vertex array.
Case Vertex array without z and without m [x, y] without z and with m [x, y, m] with z and without m [x, y, z] with z and with m [x, y, z, m] Example//3D polygon rings with mvalues (note that the second ring does not have mvalues defined for it) const rings = [ [ // first ring [97.06138,32.837,35.1,4.8], [97.06133,32.836,35.2,4.1], [97.06124,32.834,35.3,4.2], [97.06138,32.837,35.1,4.8] // same as first vertex ], [ // second ring [97.06326,32.759,35.4], [97.06298,32.755,35.5], [97.06153,32.749,35.6], [97.06326,32.759,35.4] // same as first vertex ] ]; const polygon = new Polygon({ hasZ: true, hasM: true, rings: rings, spatialReference: { wkid: 4326 } });

spatialReference
InheritedPropertyspatialReference SpatialReferenceautocast
Inherited from Geometry 
The spatial reference of the geometry.
 Default Value:WGS84 (wkid: 4326)
Method Overview
Name  Return Type  Summary  Class 

Adds one or more handles which are to be tied to the lifecycle of the object.  Accessor  
Polygon  Adds a ring to the Polygon.  Polygon  
Polygon  Creates a deep clone of Polygon object.  Polygon  
Boolean  Checks on the client if the input point is inside the polygon.  Polygon  
Polygon  Converts the given Extent to a Polygon instance.  Polygon  
*  Creates a new instance of this class and initializes it with values from a JSON object generated from an ArcGIS product.  Geometry  
Point  Returns a point specified by a ring and point in the path.  Polygon  
Boolean  Returns true if a named group of handles exist.  Accessor  
Polygon  Inserts a new point into the polygon.  Polygon  
Boolean  Checks if a Polygon ring is clockwise.  Polygon  
Removes a group of handles owned by the object.  Accessor  
Point[]  Removes a point from the polygon at the given  Polygon  
Point[]  Removes a ring from the Polygon.  Polygon  
Polygon  Updates a point in the polygon.  Polygon  
Object  Converts an instance of this class to its ArcGIS portal JSON representation.  Geometry 
Method Details

Inherited from Accessor
Since: ArcGIS Maps SDK for JavaScript 4.25Accessor since 4.0, addHandles added at 4.25. 
Adds one or more handles which are to be tied to the lifecycle of the object. The handles will be removed when the object is destroyed.
// Manually manage handles const handle = reactiveUtils.when( () => !view.updating, () => { wkidSelect.disabled = false; }, { once: true } ); this.addHandles(handle); // Destroy the object this.destroy();
ParametershandleOrHandles WatchHandleWatchHandle[]Handles marked for removal once the object is destroyed.
groupKey *optionalKey identifying the group to which the handles should be added. All the handles in the group can later be removed with Accessor.removeHandles(). If no key is provided the handles are added to a default group.

addRing
addRing(points){Polygon}

Adds a ring to the Polygon. The ring can be one of the following: an array of numbers or an array of points. When added the index of the ring is incremented by one.
ParameterA polygon ring. The first and last coordinates/points in the ring must be the same. This can either be defined as an array of Point geometries or an array of XY coordinates.
ReturnsType Description Polygon Returns the polygon with the new ring included.

contains
contains(point){Boolean}

Checks on the client if the input point is inside the polygon. A point on the polygon line is considered inside.
Parameterpoint PointThe point to test whether it is contained within the testing polygon.
ReturnsType Description Boolean Returns true
if the point is located inside the polygon.

fromExtent
fromExtent(extent){Polygon}static

Converts the given Extent to a Polygon instance. This is useful for scenarios in which you would like to display an area of interest, which is typically defined by an Extent or bounding box, as a polygon with a fill symbol in the view. Some geoprocessing tools require input geometries to be of a Polygon type and not an Extent.
Parameterextent ExtentAn extent object to convert to a polygon.
ReturnsType Description Polygon A polygon instance representing the given extent. Exampleview.on("click", function(evt) { const area = Polygon.fromExtent(view.extent); const graphic = new Graphic({ geometry: area, symbol: { type: "simplefill" } }); view.graphics.add(graphic); });

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.Parameterjson ObjectA 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.
ReturnsType Description * Returns a new instance of this class.

getPoint
getPoint(ringIndex, pointIndex){Point}

Returns a point specified by a ring and point in the path.
ParametersringIndex NumberThe index of the ring containing the desired point.
pointIndex NumberThe index of the desired point within the ring.
ReturnsType Description Point Returns the point at the specified ring index and point index.

hasHandles
InheritedMethodhasHandles(groupKey){Boolean}
Inherited from AccessorSince: ArcGIS Maps SDK for JavaScript 4.25Accessor since 4.0, hasHandles added at 4.25. 
Returns true if a named group of handles exist.
ParametergroupKey *optionalA group key.
ReturnsType Description Boolean Returns true
if a named group of handles exist.Example// Remove a named group of handles if they exist. if (obj.hasHandles("watchviewupdates")) { obj.removeHandles("watchviewupdates"); }

insertPoint
insertPoint(ringIndex, pointIndex, point){Polygon}

Inserts a new point into the polygon.
ParametersringIndex NumberThe index of the ring in which to insert the point.
pointIndex NumberThe index of the point to insert within the ring.
The point to insert.
ReturnsType Description Polygon Returns the updated polygon.

isClockwise
isClockwise(ring){Boolean}

Checks if a Polygon ring is clockwise.
ParameterA polygon ring. The first and last coordinates/points in the ring must be the same. This can either be defined as an array of Point geometries or an array of XY coordinates.
ReturnsType Description Boolean Returns true
if the ring is clockwise andfalse
for counterclockwise.

Inherited from Accessor
Since: ArcGIS Maps SDK for JavaScript 4.25Accessor since 4.0, removeHandles added at 4.25. 
Removes a group of handles owned by the object.
ParametergroupKey *optionalA group key or an array or collection of group keys to remove.
Exampleobj.removeHandles(); // removes handles from default group obj.removeHandles("handlegroup"); obj.removeHandles("otherhandlegroup");

Removes a ring from the Polygon. The index specifies which ring to remove.
Parameterindex NumberThe index of the ring to remove.
Returns

setPoint
setPoint(ringIndex, pointIndex, point){Polygon}

Updates a point in the polygon.
ParametersringIndex NumberThe index of the ring containing the point to update.
pointIndex NumberThe index of the point to update within the ring.
The new point geometry.
ReturnsType Description Polygon Returns the updated polygon.

toJSON
InheritedMethodtoJSON(){Object}
Inherited from Geometry 
Converts an instance of this class to its ArcGIS portal JSON representation. See the Using fromJSON() guide topic for more information.
ReturnsType Description Object The ArcGIS portal JSON representation of an instance of this class.