Select to view content in your preferred language

How Can I create circle in 4.6?

2819
5
04-13-2018 05:32 AM
KutayDeril
Emerging Contributor

I want to create a 2d circle like in below example but I want it as static for showing the radius of point. However, I have no idea about how should I write to codes.  How can I create a basic circle? 

ArcGIS API for JavaScript Sandbox 

0 Kudos
5 Replies
RobertScheitlin__GISP
MVP Emeritus
0 Kudos
KutayDeril
Emerging Contributor

I don't understand of that example. I would like to create a simple 2d static circle just like point. 

How can I add to map these ring polygon coordinates? 

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Kutay,


  I’m not sure what is not to understand the Circle geometry takes a point and a radius and units and creates a 2D circle in the map. You add it to the views.graphics or a GraphicsLayer like you would any other Graphic.

0 Kudos
KutayDeril
Emerging Contributor

var polygon = {
type: "polygon", // autocasts as new Polygon()
rings: [
[32.909550, 40.751906]
]
};

var fillSymbol = {
type: "simple-fill", // autocasts as new SimpleFillSymbol()
color: [227, 139, 79, 0.8],
outline: { // autocasts as new SimpleLineSymbol()
color: [255, 255, 255],
width: 1
}
};

var polygonGraphic = new Graphic({
geometry: polygon,
symbol: fillSymbol
});

view.graphics.add(polygonGraphic);

I understand the other graphics structure but I don't understand circle. Where did I wrong?

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Kutay,


  So the first part you have in your code where you define a polygon you need to use the Circle class instead and specify the radius, center and radiusUnits properties