Download Rasters Clip Geometry input Rings

188
2
Jump to solution
12-14-2020 12:35 PM
GisAdminCOG
New Contributor II

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

 

Tags (1)
0 Kudos
1 Solution

Accepted Solutions
JohnGrayson
Esri Regular Contributor

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())

 

View solution in original post

0 Kudos
2 Replies
JohnGrayson
Esri Regular Contributor

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())

 

0 Kudos
GisAdminCOG
New Contributor II

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:

GisAdminCOG_0-1608068157887.png

Thanks!!!

 

 

0 Kudos