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.
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.