How to retrieve Circle from SketchViewModel

80
3
06-01-2020 12:49 PM
Highlighted
New Contributor II

Hello,

I am using SketchViewModel to create geometries into my Scene View. It seems to be working fine, however I ´ve noticed that when using the tool to draw a circle the graphic on the "create" event is a Polygon. It consists of one ring with many points on it.

I needed to get the radius and center point of this created geometry. I can get the center of it, but since it´s a polygon i couldn´t find the radius of it.

There is any way of converting this polygon to a circle? Or to retrieve a Circle geometry when using 'circle' as drawing tool? Or should I just use another strategy for drawing circles?

Thanks!

Reply
0 Kudos
3 Replies
Highlighted
Occasional Contributor III

There's no circle geometry type in the API. If necessary, one option is to call the geometryEngine to get the distance between the center and any one of the points.

Reply
0 Kudos
Highlighted
New Contributor II

There is a Circle geometry on documentation.

It is a subclass of polygon but I don`t understand why SketchViewModel returns a polyon with lots of points instead of a Circle when drawing tool is set to 'circle'.

Thanks for the response, I will try to compute this distance!

Reply
0 Kudos
Highlighted
Occasional Contributor III

Correct, it's just a Polygon and not a different type of geometry; this means it will always be just 'lots of points'.  The way I like to think of it is that the Circle class facilitates and simplifies how those points get created, just like the sketch related tools. The only additional benefit of returning a Circle instead of a Polygon would be to have some of the Circle specific properties, but it wouldn't change the underlying list of points as those would be exactly the same for both the Circle or Polygon. This sounds like a good enhancement request or ArcGIS Ideas.

Reply
0 Kudos