Get Geographic Coordinates From Polygon Rings

1494
1
11-18-2018 09:28 AM
EssaddekMohammed
New Contributor II

Hi All,

I would like to get geographic coordinates from a drawn polygon using the SketchViiewModel. But actually the api gets only ring.

switch (sketchViewModel.graphic.symbol.type)
{
case "symple-marker": {
$("#Longitude").val(event.geometry.longitude);
$("#Latitude").val(event.geometry.latitude);
break;
}
case "polygon": {

event.geometry.rings; // ??

break;
}
}

Is there anyway to do it?

Regards.

0 Kudos
1 Reply
RobertScheitlin__GISP
MVP Emeritus

Essaddek,

  The rings property is a two dimensional array means it is an array of arrays of coordinates. So you have to loop through the rings array to get the polygons rings and then loop over the ring vertex coordinates. You can use the getPoint method to get a specific point from a specific rings of a Polygon.

Polygon | API Reference | ArcGIS API for JavaScript 3.26 

0 Kudos