Polygons are made up of rings, rings are made up of points.This same 'path' can be used following, for example, an Identify operation to get the points of a feature.
can you give me a example with code?
for(var i=0;i<thePoly.rings.length;i++){ console.log("Getting points from ring #" + i); for(var j=0;j<thePoly.rings.length;j++){ console.log("Point #" + j + " x=" + thePoly.rings[0] + " y=" + thePoly.rings[1] + " (using array access)"); console.log("Point #" + j + " x=" + thePoly.getPoint(i, j).x + " y=" + thePoly.getPoint(i, j).y + " (using getPoint())"); } } //Could replace the access with a call to thePoly.getPoint(i,j) if you like which would return a copy of the Point rather than a reference to the actual Point
I'm not going to do it all for you 🙂But here's one approach, assume you've got a polygon (thePoly), perhaps it's the geometry property of a Graphic: for(var i=0;i<thePoly.rings.length;i++){ console.log("Getting points from ring #" + i); for(var j=0;j<thePoly.rings.length;j++){ console.log("Point #" + j + " x=" + thePoly.rings.x + " y=" + thePoly.rings.y); } } //Could replace the access with a call to thePoly.getPoint(i,j) if you like which would return a copy of the Point rather than a reference to the actual Point (haven't tested the code, just typed straight into this post, should be roughly right though)
for(var i=0;i<thePoly.rings.length;i++){ console.log("Getting points from ring #" + i); for(var j=0;j<thePoly.rings.length;j++){ console.log("Point #" + j + " x=" + thePoly.rings.x + " y=" + thePoly.rings.y); } } //Could replace the access with a call to thePoly.getPoint(i,j) if you like which would return a copy of the Point rather than a reference to the actual Point
it is failse to get x =thePoly.rings.x
Signed in members can post, follow updates, and more. New here? Register a free account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.