title: JSTS : How to union of more then two polygons in openlayer2 using JSTS library
body: <p>I am doing a project In which I have to take union of many polygons if their edges are intersecting.Polygons maybe more then 100 but they have to make a union shape. Till now I just found that in jSTS we can by using </p>
  
  <blockquote>
    <p>a=b.union(c);</p>
  </blockquote>
  
  <p>But It is not working for me as its just for 2 polygons.</p>
  
  <p>My code is </p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code> 
  
     var strGeom = new OpenLayers.Format.WKT(geom);
     var parseGeo = reader.read(strGeom.toString());
     union = parseGeo.union(parseGeo);
     var parser = new jsts.io.OpenLayersParser();
     union = parser.write(union);
     console.log(union);
     var strGeom = new OpenLayers.Format.WKT(union);</code></pre>
  </div>
  </div>
  </p>
  
  <p><a href="https://i.stack.imgur.com/TZ1rH.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/TZ1rH.png" alt="Just like that"></a></p>