title: Geojson/ turf : merge multiple polygons to one polygon keeping hole
body: <p>So I want to merge adjacent polygons in javascript this is what I actually have with my code:</p>
  <p><a href="https://i.stack.imgur.com/rnwwX.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/rnwwX.png" alt="map" /></a></p>
  <p>I want to remove inside stroke but keep border stroke.</p>
  <p>So I want to go from this:</p>
  <p><a href="https://i.stack.imgur.com/X6zmL.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/X6zmL.png" alt="map2" /></a></p>
  <p>To this:</p>
  <p><a href="https://i.stack.imgur.com/Kcpm9.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Kcpm9.png" alt="map3" /></a></p>
  <p>I want to keep the hole for Paris - I can defined which polygons have to be grouped but I cannot merge them with this code:</p>
  <pre><code>var map = L.map('map', {
      center: [46.52863469527167, 2.43896484375],
      zoom: 6,
      maxZoom: 18,
      minZoom: 7
  });
  $http.get(&quot;france.json&quot;).then(function (response) {
      $scope.communeFr = response.data.features
      $http.get(apiult).then(function (response) {
          $scope.showCommune = response.data.Liste
          $scope.communeFr.map(x =&gt; {
              x.show = false
              for (let i = 0; i &lt; $scope.showCommune .length; i++) {
                  if (x.properties.insee == $scope.showCommune[i].insee) {
                      x.show = true
                      return
                  }
              }                
          })
          L.geoJson($scope.communeFr, {
              filter: function (feature, latlng) {
                  return feature.show 
              }
          }).addTo(map);
      });
      
  });
  </code></pre>
  <p>UPDATE - I tried with <code>turf.union</code> but the output is not right:</p>
  <p><a href="https://i.stack.imgur.com/IbCX4.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/IbCX4.png" alt="map4" /></a></p>
  <p>This is my code</p>
  <pre><code>var GroupPolygons = [];    
  $scope.communeFr.map(x =&gt; {
      x.show = false
      for (let i = 0; i &lt; $scope.showCommune .length; i++) {
          if (x.properties.insee == $scope.showCommune[i].insee) {
              GroupPolygons.push(x)
          }
      }                
  })
  var union = turf.union(...GroupPolygons)
  L.geoJson(union).addTo(map)
  </code></pre>