Hello,
I am new to using ArcGIS API, I need your help. someone can help me, I'm doing a project where the user draws a polygon and need to capture the coordinates of the polygon drawn.
I am leading this examplehttps://developers.arcgis.com/javascript/3/jssamples/util_label_point.html
Thank you...
I think here u can get them: function addToMap(evtObj) { map.graphics.clear(); var geometry = evtObj.geometry; // add the drawn graphic to the map var symbol = new SimpleFillSymbol( SimpleFillSymbol.STYLE_SOLID, new SimpleLineSymbol(SimpleLineSymbol.STYLE_SOLID, new Color([0, 0, 0]), 2), new Color([0, 0, 255, 0.5])); var graphic = new Graphic(geometry, symbol);
// u will have the geometry itself so u can get the coords for the polygon drawn but u need to use a for loop to get them all. console.log(geometry.rings); //<-- array of coords.
map.graphics.add(graphic); // simplify polygon so it can be used in the get label points request geometryService.simplify([geometry], getLabelPoints); }
Thank you very much, I'll try.
Aangemelde leden kunnen berichten plaatsen, updates volgen en meer. Nieuw hier? Registreer een gratis account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.