I am developing an app that allows users to define a polygon and download rasters from a MOSIAC imagery layer. The option for "Clip Geometry" requires input using RINGS. I have a polygon and can obtain the rings but how can i get it into the format required such as...
{"rings" : [[[-12509684.957104227,3973706.8078114213],[-12508328.199852167,3973553.933754851],[-12508538.401679952,3972866.0005002855],[-12509761.394132512,3972846.8912432143],[-12509684.957104227,3973706.8078114213]]]}
if i use polygon.rings I just get a series of XY pairs
Solved! Go to Solution.
Hard to tell without a codepen/jsbin/other, but you could try looking at the json representation of the geometry:
const polygonJSON = polygon.toJSON();
console.info('Polygon as JSON:', polygonJSON);
// if sending as REST parameter //
'paramName': JSON.stringify(polygon.toJSON())
Hard to tell without a codepen/jsbin/other, but you could try looking at the json representation of the geometry:
const polygonJSON = polygon.toJSON();
console.info('Polygon as JSON:', polygonJSON);
// if sending as REST parameter //
'paramName': JSON.stringify(polygon.toJSON())
Wow, this is exactly what I was looking for. That JSON.stringify part gave me what I needed, the rings in a format I can use in the Imagery Download tool:
Thanks!!!