Bug in 4.12 JS API - Circle no longer has radius property

489
4
07-03-2019 12:52 PM
Jay_Gregory
Occasional Contributor III

At least when using the sketch widget, upon drawing a circle, the object's geometry no longer has a radius property.  This was not the case in 4.11 version of the API, where you did have access to the radius property after drawing a circle.  Don't know if this is the case with all circle objects in the API....

Reproducible @ https://codepen.io/crackernutter/pen/LKrmQb

Change codepen API to 4.11 to see the changes....

0 Kudos
4 Replies
BenElan
Esri Contributor

Hi Jay,

 

You can still calculate the radius of a circle by accessing the extent's width and dividing by two.

 

In your Code Pen example it would be: console.log(evt.item.geometry.extent.width/2);

0 Kudos
Jay_Gregory
Occasional Contributor III

Thanks!  That is a very good point - 

However, the benefit of having the radius property is that it is also a handy way to track the the original geometry was a circle in the first place - since arbitrary polygons or rectangles don't have that property.  Our users like knowing the radius of their circles, so I'd have to "mark" the graphic as a circle somehow to know that I would need to calculate the radius - otherwise the application would display the radius for other polygons as well.  

It's not a huge deal, but I did like that the property was there in 4.11 - if it's being removed in 4.12 that's fine, I just thought it was a bug

RobertScheitlin__GISP
MVP Esteemed Contributor

Jay,

   I am sure it is a bug and that you need to report this to esri tech support.

0 Kudos
BenElan
Esri Contributor

Hello Jay,

I have logged a bug for this issue: BUG-000123558

Thanks.