require(["esri/geometry/Circle"], (Circle) => { /* code goes here */ });
import Circle from "@arcgis/core/geometry/Circle.js";
esri/geometry/Circle
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
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
-
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 |
---|---|---|---|
The cache is used to store values computed from geometries that need to be cleared or recomputed upon mutation. | Geometry | ||
The center point of the circle. | Circle | ||
The centroid of the polygon. | Polygon | ||
The name of the class. | Accessor | ||
The extent of the geometry. | Geometry | ||
Applicable when the spatial reference of the center point is either set to Web Mercator (wkid: 3857) or geographic/geodesic (wkid: 4326). | Circle | ||
Indicates if the geometry has M values. | Geometry | ||
Indicates if the geometry has z-values (elevation). | Geometry | ||
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. | Polygon | ||
This value defines the number of points along the curve of the circle. | Circle | ||
The radius of the circle. | Circle | ||
Unit of the radius. | Circle | ||
An array of rings. | Polygon | ||
The spatial reference of the geometry. | Geometry | ||
The string value representing the type of geometry. | Polygon |
Property Details
-
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).
-
geodesic
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
-
hasZ
InheritedPropertyhasZ Boolean
Inherited from Geometry -
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.
-
numberOfPoints
numberOfPoints Number
-
This value defines the number of points along the curve of the circle.
- Default Value:60
-
radius
radius Number
-
The radius of the circle.
- Default Value:1000
-
radiusUnit
radiusUnit String
-
Unit of the radius.
Possible Values:"feet" |"kilometers" |"meters" |"miles" |"nautical-miles" |"yards"
- Default Value:meters
-
Inherited from Polygon
-
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.
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 } });
-
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 | ||
Adds a ring to the Polygon. | Polygon | ||
Creates a deep clone of Circle. | Circle | ||
Checks on the client if the input point is inside the polygon. | Polygon | ||
* | Creates a new instance of this class and initializes it with values from a JSON object generated from an ArcGIS product. | Geometry | |
Returns a point specified by a ring and point in the path. | Polygon | ||
Returns true if a named group of handles exist. | Accessor | ||
Inserts a new point into the polygon. | Polygon | ||
Checks if a Polygon ring is clockwise. | Polygon | ||
Removes a group of handles owned by the object. | Accessor | ||
Removes a point from the polygon at the given | Polygon | ||
Removes a ring from the Polygon. | Polygon | ||
Updates a point in the polygon. | Polygon | ||
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 WatchHandle|WatchHandle[]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
InheritedMethodaddRing(points){Polygon}
Inherited from 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.
ParameterReturnsType Description Polygon Returns the polygon with the new ring included.
-
contains
InheritedMethodcontains(point){Boolean}
Inherited from Polygon -
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.
-
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.
-
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("watch-view-updates")) { obj.removeHandles("watch-view-updates"); }
-
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("handle-group"); obj.removeHandles("other-handle-group");
-
Inherited from Polygon
-
Removes a point from the polygon at the given
pointIndex
within the ring identified byringIndex
.ParametersReturns
-
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.