<?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: Merge several polygon in Javascript in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/merge-several-polygon-in-javascript/m-p/560197#M52260</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Correct. The Union works with the actual geometry not the layer.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 14 Jul 2020 13:00:38 GMT</pubDate>
    <dc:creator>RobertScheitlin__GISP</dc:creator>
    <dc:date>2020-07-14T13:00:38Z</dc:date>
    <item>
      <title>Merge several polygon in Javascript</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/merge-several-polygon-in-javascript/m-p/560194#M52257</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I want to merge random polygons placed on a graphics layer make a single polygon with only one boundary. Also how to unmerge them.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Jul 2020 12:35:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/merge-several-polygon-in-javascript/m-p/560194#M52257</guid>
      <dc:creator>rsharma</dc:creator>
      <dc:date>2020-07-14T12:35:25Z</dc:date>
    </item>
    <item>
      <title>Re: Merge several polygon in Javascript</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/merge-several-polygon-in-javascript/m-p/560195#M52258</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Merge/Union:&amp;nbsp;&lt;A class="link-bare" href="https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-geometryEngine.html#union" title="https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-geometryEngine.html#union"&gt;https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-geometryEngine.html#union&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To un-merge you loop though the Polygons rings and copy those ring arrays to another Polygon class.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Jul 2020 12:39:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/merge-several-polygon-in-javascript/m-p/560195#M52258</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2020-07-14T12:39:05Z</dc:date>
    </item>
    <item>
      <title>Re: Merge several polygon in Javascript</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/merge-several-polygon-in-javascript/m-p/560196#M52259</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi robert,&lt;/P&gt;&lt;P&gt;long time to hear from your side... how are you, well thanks for the reply, i already get the union link, but couldn't find any example,&amp;nbsp; if u have any link then pls send..&lt;/P&gt;&lt;P&gt;like i have found this&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.esri.com/thread/247540"&gt;Merge Polygons in JavaScript API 4.14&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Do, i need to to loop through all the polygons of a layer, to get its graphics geomtrry&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Jul 2020 12:52:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/merge-several-polygon-in-javascript/m-p/560196#M52259</guid>
      <dc:creator>rsharma</dc:creator>
      <dc:date>2020-07-14T12:52:19Z</dc:date>
    </item>
    <item>
      <title>Re: Merge several polygon in Javascript</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/merge-several-polygon-in-javascript/m-p/560197#M52260</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Correct. The Union works with the actual geometry not the layer.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Jul 2020 13:00:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/merge-several-polygon-in-javascript/m-p/560197#M52260</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2020-07-14T13:00:38Z</dc:date>
    </item>
    <item>
      <title>Re: Merge several polygon in Javascript</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/merge-several-polygon-in-javascript/m-p/560198#M52261</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;jQuery('#main').on('click','.merge_boundary',function(){&lt;BR /&gt; var updatedGeometry=new Array();&lt;BR /&gt; graphicsLayer.graphics.map(function(gra){&lt;BR /&gt; updatedGeometry.push(webMercatorUtils.webMercatorToGeographic(gra.geometry));&lt;BR /&gt; });&lt;BR /&gt; var joinedPolygons = geometryEngine.union(updatedGeometry);/&lt;STRONG&gt;/it returned all&amp;nbsp; polygons as it is, do not merge to make it one&lt;/STRONG&gt;&lt;BR /&gt; console.log(joinedPolygons.rings);&lt;BR /&gt; addGraphics(joinedPolygons.rings);&lt;BR /&gt; });&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Jul 2020 13:22:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/merge-several-polygon-in-javascript/m-p/560198#M52261</guid>
      <dc:creator>rsharma</dc:creator>
      <dc:date>2020-07-14T13:22:32Z</dc:date>
    </item>
    <item>
      <title>Re: Merge several polygon in Javascript</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/merge-several-polygon-in-javascript/m-p/560199#M52262</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Rajni,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;This is better code. See if this helps.&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;  &lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; updatedGeometry &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; graphicsLayer&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;graphics&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;map&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="keyword token"&gt;function&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;gra&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
    &lt;SPAN class="keyword token"&gt;return&lt;/SPAN&gt; webMercatorUtils&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;webMercatorToGeographic&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;gra&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;geometry&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
  &lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 00:10:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/merge-several-polygon-in-javascript/m-p/560199#M52262</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2021-12-12T00:10:36Z</dc:date>
    </item>
    <item>
      <title>Re: Merge several polygon in Javascript</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/merge-several-polygon-in-javascript/m-p/560200#M52263</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think this function works for only intersected boundaries: i used the solution below, and it is working fine.&lt;/P&gt;&lt;P&gt;merge.addEventListener('click',function(){&lt;BR /&gt; var updatedGeometry=new Array();&lt;BR /&gt; graphicsLayer.graphics.map(function(gra){&lt;BR /&gt; updatedGeometry.push(new Polygon((gra.geometry)));&lt;BR /&gt; });&lt;BR /&gt; &lt;BR /&gt; var joinedPolygons = geometryEngine.union(updatedGeometry);&lt;BR /&gt; graphicsLayer.removeAll();&lt;BR /&gt; joinedPolygons.rings.forEach(function(ring)&lt;BR /&gt; {&lt;BR /&gt; resultpolygon={type:"polygon",rings:[ring]};&lt;BR /&gt; var resultgraphic =new Graphic({&lt;BR /&gt; geometry: resultpolygon,&lt;BR /&gt; symbol: resultsymbol&lt;BR /&gt; });&lt;BR /&gt; &lt;BR /&gt; graphicsLayer.add(resultgraphic);&lt;BR /&gt; // console.log(ring);&lt;BR /&gt; });&lt;BR /&gt; });&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jul 2020 11:35:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/merge-several-polygon-in-javascript/m-p/560200#M52263</guid>
      <dc:creator>rsharma</dc:creator>
      <dc:date>2020-07-15T11:35:24Z</dc:date>
    </item>
  </channel>
</rss>

