title: Create array of polygon coordinates from the xml
body: <p>I have polygon coordinates in XML file to display the polygon shapes on Google map and I just want to get them from the xml and needs to create array like below. </p>
  
  <pre><code> var triangleCoords = [
                                new google.maps.LatLng(51.055221725218054, -3.1630325317382812),
                                new google.maps.LatLng(51.010961025187314, -3.1359100341796875),
                                new google.maps.LatLng(51.043135193868025, -3.063812255859375)
  
                            ];
  </code></pre>
  
  <p>Thanks for your reply. Here is the below code and it's not displaying polygon shapes. </p>
  
  <pre><code>var bermudaTriangle;
  
  
                          var points = "(51.055221725218054, -3.1630325317382812),(51.010961025187314, -3.1359100341796875),(51.043135193868025, -3.063812255859375)";
  
  
                          points = points.substr(1, points.length - 2).split("),(");
                          var triangleCoords = points.map(function (pointString) {
                              var latlon = pointString.split(", ");
                              return { lat: latlon[0], lon: latlon[1] };
                          });
  
  
                          // Construct the polygon
                          bermudaTriangle = new google.maps.Polygon({
                              paths: JSON.stringify(triangleCoords),
                              strokeColor: '#FF0000',
                              strokeOpacity: 0.8,
                              strokeWeight: 2,
  
                              fillColor: '#FF0000',
                              fillOpacity: 0.35
                          });
  
                          bermudaTriangle.setMap(map);
  
                      });
  </code></pre>
  
  <p>XML code get the coordinates.</p>
  
  <pre><code>   $(xml).find('Location').each(function () {
  
  
                          var points= $(this).find('Coodinates').text();
  </code></pre>
  
  <p>// here I will get the points successfully but needs to create the array as above (51.055221725218054, -3.1630325317382812),(51.010961025187314, -3.1359100341796875),(51.043135193868025, -3.063812255859375)</p>
  
  <p>}</p>