Circle

AMD: require(["esri/geometry/Circle"], (Circle) => { /* code goes here */ });
ESM: import Circle from "@arcgis/core/geometry/Circle";
Class: esri/geometry/Circle
Inheritance: Circle Polygon Geometry Accessor
Since: ArcGIS API for JavaScript 4.0

A circle is a Polygon created by specifying a center point and a radius. The point can be provided as a Point object or an array of latitude/longitude values.

The SpatialReference of the center will determine the spatial reference of the circle. If you provide an array of longitude/latitude coordinates as the center, the spatial reference will default to WGS84 (wkid 4326). You cannot set the spatialReference property of the circle itself. It must always be set in the center point.

See also:
Example:
const circleGeometry = new Circle({
  center: [ -113, 36 ],
  geodesic: true,
  numberOfPoints: 100,
  radius: 100,
  radiusUnit: "kilometers"
});

view.graphics.add(new Graphic({
  geometry: circleGeometry,
  symbol: {
    type: "simple-fill",
    style: "none",
    outline: {
      width: 3,
      color: "red"
    }
  }
}));

Constructors

new Circle(properties)
Parameter:
properties Object
optional

See the properties for a list of all the properties that may be passed into the constructor.

Property Overview

Any properties can be set, retrieved or listened to. See the Working with Properties topic.
Show inherited properties Hide inherited properties
Name Type Summary Class
Objectmore details

The cache is used to store values computed from geometries that need to cleared or recomputed upon mutation.

more detailsGeometry
Pointmore details

The center point of the circle.

more detailsCircle
Pointmore details

The centroid of the polygon.

more detailsPolygon
Stringmore details

The name of the class.

more detailsAccessor
Extentmore details

The extent of the geometry.

more detailsGeometry
Booleanmore details

Applicable when the spatial reference of the center point is either set to Web Mercator (wkid: 3857) or geographic/geodesic (wkid: 4326).

more detailsCircle
Booleanmore details

Indicates if the geometry has M values.

more detailsGeometry
Booleanmore details

Indicates if the geometry has z-values (elevation).

more detailsGeometry
Booleanmore details

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

more detailsPolygon
Numbermore details

This value defines the number of points along the curve of the circle.

more detailsCircle
Numbermore details

The radius of the circle.

more detailsCircle
Stringmore details

Unit of the radius.

more detailsCircle
Number[][][]more details

An array of rings.

more detailsPolygon
SpatialReferencemore details

The spatial reference of the geometry.

more detailsGeometry
Stringmore details

The string value representing the type of geometry.

more detailsPolygon

Property Details

cache Objectreadonly inherited

The cache is used to store values computed from geometries that need to cleared or recomputed upon mutation. An example is the extent of a polygon.

center Pointautocast
Autocasts from Object|Number[]

The center point of the circle. The center must be specified either as a Point or an array of longitude/latitude coordinates. The spatial reference of the center will determine the spatial reference of the circle. If you provide an array of longitude/latitude coordinates, the spatial reference will default to WGS84 (wkid 4326).

centroid Point inherited

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

declaredClass Stringreadonly inherited
Since: ArcGIS API for JavaScript 4.7

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

extent Extentreadonly inherited

The extent of the geometry. For a point, the extent is null.

geodesic Boolean

Applicable when the spatial reference of the center point is either set to Web Mercator (wkid: 3857) or geographic/geodesic (wkid: 4326). When either of those spatial references is used, set geodesic to true to minimize distortion. Other coordinate systems will not create geodesic circles.

Default Value:false

Indicates if the geometry has M values.

Indicates if the geometry has z-values (elevation).

Z-values 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 Boolean inherited

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

numberOfPoints Number

This value defines the number of points along the curve of the circle.

Default Value:60
radius Number

The radius of the circle.

Default Value:1000
radiusUnit String

Unit of the radius.

Possible Values:"feet"|"kilometers"|"meters"|"miles"|"nautical-miles"|"yards"

Default Value:meters

An array of rings. Each ring is a two-dimensional 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 m-values (note that the second ring does not have m-values 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 }
});

The spatial reference of the geometry.

Default Value:WGS84 (wkid: 4326)
type Stringreadonly inherited

The string value representing the type of geometry.

For Polygon the type is always "polygon".

Method Overview

Show inherited methods Hide inherited methods
Name Return Type Summary Class
Polygonmore details

Adds a ring to the Polygon.

more detailsPolygon
Circlemore details

Creates a deep clone of Circle.

more detailsCircle
Booleanmore details

Checks on the client if the input point is inside the polygon.

more detailsPolygon
*more details

Creates a new instance of this class and initializes it with values from a JSON object generated from an ArcGIS product.

more detailsGeometry
Pointmore details

Returns a point specified by a ring and point in the path.

more detailsPolygon
Polygonmore details

Inserts a new point into the polygon.

more detailsPolygon
Booleanmore details

Checks if a Polygon ring is clockwise.

more detailsPolygon
Point[]more details

Removes a point from the polygon at the given pointIndex within the ring identified by ringIndex.

more detailsPolygon
Point[]more details

Removes a ring from the Polygon.

more detailsPolygon
Polygonmore details

Updates a point in the polygon.

more detailsPolygon
Objectmore details

Converts an instance of this class to its ArcGIS portal JSON representation.

more detailsGeometry

Method Details

addRing(points){Polygon}inherited

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.

Parameter:

A 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.

Returns:
Type Description
Polygon Returns the polygon with the new ring included.
clone(){Circle}

Creates a deep clone of Circle.

Returns:
Type Description
Circle A new instance of a Circle object equal to the object used to call .clone().
contains(point){Boolean}inherited

Checks on the client if the input point is inside the polygon. A point on the polygon line is considered inside.

Parameter:
point Point

The point to test whether it is contained within the testing polygon.

Returns:
Type Description
Boolean Returns true if the point is located inside the polygon.
fromJSON(json){*}static

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.

Parameter:
json Object

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:
Type Description
* Returns a new instance of this class.
getPoint(ringIndex, pointIndex){Point}inherited

Returns a point specified by a ring and point in the path.

Parameters:
ringIndex Number

The index of the ring containing the desired point.

pointIndex Number

The index of the desired point within the ring.

Returns:
Type Description
Point Returns the point at the specified ring index and point index.
insertPoint(ringIndex, pointIndex, point){Polygon}inherited

Inserts a new point into the polygon.

Parameters:
ringIndex Number

The index of the ring in which to insert the point.

pointIndex Number

The index of the point to insert within the ring.

point Point|Number[]

The point to insert.

Returns:
Type Description
Polygon Returns the updated polygon.
isClockwise(ring){Boolean}inherited

Checks if a Polygon ring is clockwise.

Parameter:

A 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.

Returns:
Type Description
Boolean Returns true if the ring is clockwise and false for counterclockwise.
removePoint(ringIndex, pointIndex){Point[]}inherited

Removes a point from the polygon at the given pointIndex within the ring identified by ringIndex.

Parameters:
ringIndex Number

The index of the ring containing the point to remove.

pointIndex Number

The index of the point to remove within the ring.

Returns:
Type Description
Point[] Returns the geometry of the removed point.
removeRing(index){Point[]}inherited

Removes a ring from the Polygon. The index specifies which ring to remove.

Parameter:
index Number

The index of the ring to remove.

Returns:
Type Description
Point[] Returns array of points representing the removed ring.
setPoint(ringIndex, pointIndex, point){Polygon}inherited

Updates a point in the polygon.

Parameters:
ringIndex Number

The index of the ring containing the point to update.

pointIndex Number

The index of the point to update within the ring.

point Point|Number[]

The new point geometry.

Returns:
Type Description
Polygon Returns the updated polygon.
toJSON(){Object}inherited

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

Returns:
Type Description
Object The ArcGIS portal JSON representation of an instance of this class.

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