<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Get coodinate from each point of the polygon on ArcGIS? in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/get-coodinate-from-each-point-of-the-polygon-on/m-p/1131900#M75851</link>
    <description>&lt;P&gt;I wrote something that can help with this just recently.&lt;/P&gt;&lt;P&gt;&lt;A href="https://www.npmjs.com/package/@odoe/explode" target="_blank" rel="noopener"&gt;https://www.npmjs.com/package/@odoe/explode&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;const lines = explode(polygon);
const points = lines.map(explode).flat();&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You are going to get some duplicate points though, because the end vertex for one line is the start vertex for another, so you'll need to do some filtering.&lt;/P&gt;&lt;P&gt;I might be able to add some options to do this in the method in the future, but I didn't need it for what I was doing.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sun, 09 Jan 2022 20:20:08 GMT</pubDate>
    <dc:creator>ReneRubalcava</dc:creator>
    <dc:date>2022-01-09T20:20:08Z</dc:date>
    <item>
      <title>Get coodinate from each point of the polygon on ArcGIS?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/get-coodinate-from-each-point-of-the-polygon-on/m-p/1131875#M75849</link>
      <description>&lt;P&gt;I'm working with the ArcGIS API for JavaScript. I wondering is there any features I can use to get the coordinates of each vertex after I draw using the Sketch tool in the ArcGiS API? Update I try to use the webmercator method but it keep appear this error to me&lt;/P&gt;&lt;P&gt;"webMercatorUtils.webMercatorToGeographic is not a function" this is the code i written to parse it.&lt;/P&gt;&lt;P&gt;sketch&lt;A href="https://www.olehanaarabic.com/" target="_self"&gt;.&lt;/A&gt;on("create", (e: __esri.SketchCreateEvent) =&amp;gt; { if (e.state === "complete") { // this.rings = e.graphic.geometry.toJSON().rings.webMercatorUtils.webMercatorToGeographic(); this.rings = webMercatorUtils.webMercatorToGeographic(e.graphic.geometry); } });&lt;/P&gt;</description>
      <pubDate>Sun, 09 Jan 2022 09:44:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/get-coodinate-from-each-point-of-the-polygon-on/m-p/1131875#M75849</guid>
      <dc:creator>RichardSon</dc:creator>
      <dc:date>2022-01-09T09:44:14Z</dc:date>
    </item>
    <item>
      <title>Re: Get coodinate from each point of the polygon on ArcGIS?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/get-coodinate-from-each-point-of-the-polygon-on/m-p/1131900#M75851</link>
      <description>&lt;P&gt;I wrote something that can help with this just recently.&lt;/P&gt;&lt;P&gt;&lt;A href="https://www.npmjs.com/package/@odoe/explode" target="_blank" rel="noopener"&gt;https://www.npmjs.com/package/@odoe/explode&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;const lines = explode(polygon);
const points = lines.map(explode).flat();&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You are going to get some duplicate points though, because the end vertex for one line is the start vertex for another, so you'll need to do some filtering.&lt;/P&gt;&lt;P&gt;I might be able to add some options to do this in the method in the future, but I didn't need it for what I was doing.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 09 Jan 2022 20:20:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/get-coodinate-from-each-point-of-the-polygon-on/m-p/1131900#M75851</guid>
      <dc:creator>ReneRubalcava</dc:creator>
      <dc:date>2022-01-09T20:20:08Z</dc:date>
    </item>
    <item>
      <title>Re: Get coodinate from each point of the polygon on ArcGIS?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/get-coodinate-from-each-point-of-the-polygon-on/m-p/1131954#M75852</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I once did something like this and here is how you get coordinates of each vertex:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;sketch.on('create', function (event) {&lt;BR /&gt;// check if the create event's state has changed to complete indicating&lt;BR /&gt;// the graphic create operation is completed.&lt;BR /&gt;if (event.state === "complete") {&lt;/P&gt;&lt;P&gt;if (view.zoom &amp;gt;= 11) {&lt;BR /&gt;let gra = event.graphic.clone();&lt;BR /&gt;event.graphic.layer.removeAll();&lt;BR /&gt;gra.symbol.color = "red";&lt;BR /&gt;gra.layer.add(gra);&lt;BR /&gt;console.log(view.zoom);&lt;BR /&gt;console.log("X = ", gra.geometry.x);&lt;BR /&gt;console.log("Y = ", gra.geometry.y);&lt;BR /&gt;console.log("Lat = ", event.graphic.geometry.latitude);&lt;BR /&gt;console.log("Long = ", event.graphic.geometry.longitude);&lt;BR /&gt;lat = event.graphic.geometry.latitude;&lt;BR /&gt;lon = event.graphic.geometry.longitude;&lt;BR /&gt;zoomLevel = view.zoom;&lt;BR /&gt;for (var i = 0; i &amp;lt; gra.geometry.rings.length; i++){&lt;BR /&gt;for (var p = 0; p &amp;lt; gra.geometry.rings[i].length; p++){&lt;BR /&gt;crmLatitude = String(gra.geometry.getPoint(i, p));&lt;BR /&gt;crmLongitude = String(gra.geometry.getPoint(i, p));&lt;BR /&gt;var LatLon = String(gra.geometry.rings[i][p]);&lt;BR /&gt;console.log(LatLon);&lt;BR /&gt;latlon = LatLon;&lt;/P&gt;&lt;P&gt;var graphicsLayer = new GraphicsLayer();&lt;/P&gt;&lt;P&gt;var view = new MapView({&lt;BR /&gt;map: webmap,&lt;BR /&gt;container: "viewDiv",&lt;BR /&gt;popup: null&lt;BR /&gt;});&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;var featureLayer = new FeatureLayer({&lt;BR /&gt;url: featureLayerUrl&lt;BR /&gt;});&lt;/P&gt;&lt;P&gt;webmap.add(featureLayer);&lt;/P&gt;&lt;P&gt;webmap.layers.add(graphicsLayer);&lt;BR /&gt;&lt;BR /&gt;var sketch = new Sketch({&lt;BR /&gt;layer: graphicsLayer,&lt;BR /&gt;view: view,&lt;BR /&gt;availableCreateTools: ["polygon"],&lt;BR /&gt;creationMode: "update",&lt;BR /&gt;&lt;BR /&gt;});&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;view.ui.add(sketch, {&lt;BR /&gt;position: "top-right"&lt;BR /&gt;});&lt;BR /&gt;&lt;BR /&gt;var scaleBar = new ScaleBar({&lt;BR /&gt;view: view&lt;BR /&gt;});&lt;BR /&gt;// Add widget to the bottom left corner of the view&lt;BR /&gt;view.ui.add(scaleBar, {&lt;BR /&gt;position: "bottom-left"&lt;BR /&gt;});&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;sketch.on('create', function (event) {&lt;BR /&gt;// check if the create event's state has changed to complete indicating&lt;BR /&gt;// the graphic create operation is completed.&lt;BR /&gt;if (event.state === "complete") {&lt;/P&gt;&lt;P&gt;if (view.zoom &amp;gt;= 11) {&lt;BR /&gt;let gra = event.graphic.clone();&lt;BR /&gt;event.graphic.layer.removeAll();&lt;BR /&gt;gra.symbol.color = "red";&lt;BR /&gt;gra.layer.add(gra);&lt;BR /&gt;console.log(view.zoom);&lt;BR /&gt;console.log("X = ", gra.geometry.x);&lt;BR /&gt;console.log("Y = ", gra.geometry.y);&lt;BR /&gt;console.log("Lat = ", event.graphic.geometry.latitude);&lt;BR /&gt;console.log("Long = ", event.graphic.geometry.longitude);&lt;BR /&gt;lat = event.graphic.geometry.latitude;&lt;BR /&gt;lon = event.graphic.geometry.longitude;&lt;BR /&gt;zoomLevel = view.zoom;&lt;BR /&gt;for (var i = 0; i &amp;lt; gra.geometry.rings.length; i++){&lt;BR /&gt;for (var p = 0; p &amp;lt; gra.geometry.rings[i].length; p++){&lt;BR /&gt;crmLatitude = String(gra.geometry.getPoint(i, p));&lt;BR /&gt;crmLongitude = String(gra.geometry.getPoint(i, p));&lt;BR /&gt;var LatLon = String(gra.geometry.rings[i][p]);&lt;BR /&gt;console.log(LatLon);&lt;BR /&gt;latlon = LatLon;&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;debugger;&lt;BR /&gt;}&lt;BR /&gt;else{&lt;BR /&gt;alert("please zoom in");&lt;BR /&gt;event.graphic.layer.remove(event.graphic);&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;});&lt;/P&gt;</description>
      <pubDate>Mon, 10 Jan 2022 09:18:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/get-coodinate-from-each-point-of-the-polygon-on/m-p/1131954#M75852</guid>
      <dc:creator>SiyabongaKubeka</dc:creator>
      <dc:date>2022-01-10T09:18:46Z</dc:date>
    </item>
  </channel>
</rss>

