title: how to get the newly edited polygon coordinates in google map apiv3
body: <p>i have created and edited polygon successfully and after drawing the polygon i am getting the coordinates of the polygon, what i am looking for is after editing the polygon i am not getting the new coordinates of the polygon(after drag end i am getting the coordinates, immediately the new coordinates should appear as when i draw the polygon happen).</p>
  
  <p>my java script:</p>
  
  <pre><code>var map;
      var coords = [];
      var lats = [];
      var lngs = [];
      var myMarkers = [];
      var myPoly;
      function initialize() {
          var latlng = new google.maps.LatLng(17.397821, 78.479354);
          var mapOptions = {
              zoom: 15,
              center: latlng,
              mapTypeId: google.maps.MapTypeId.TERRAIN
          }
          map = new google.maps.Map(document.getElementById("map-canvas"), mapOptions);
          addEventListener_marker();
  
      }
      function addEventListener_marker() {
          google.maps.event.addListener(map, 'click', function (e) {
              coords.push(e.latLng);
              lats.push(e.latLng.lb);
              lngs.push(e.latLng.mb);
              placeMarker(e.latLng, map);
          });
      }
  
      function placeMarker(position, map) {
          var mark = new google.maps.Marker({
              position: position,
              map: map,
              draggable: false
          });
          myMarkers.push(mark);
      }
  
      function createPoly() {
          polyOptions = {
              path: coords,
              strokeColor: "#FF0000",
              strokeOpacity: 0.8,
              strokeWeight: 2,
              fillColor: "#FF6803",
              fillOpacity: '0.25',
              draggable: true,
              editable: true
          }
          myPoly = new google.maps.Polygon(polyOptions);
          myPoly.setMap(map);
          google.maps.event.addListener(myPoly, 'click', isWithinPoly);
          markerCoords();
          //removeEventListener();
          clearOverlays();
  
      }
  
      function markerCoords() {
          var curLatLng = [];
          curLatLng = myPoly.getPath().getArray();
          $("#info").append("coordinates are: Latitude: " + curLatLng + "&lt;br/&gt;");
          //google.maps.event.addListener(myPoly, 'shape_changed', function () {
          google.maps.event.addListener(myPoly, 'dragend', function () {
              //alert("drag end");
              var curLatLng;
              curLatLng = myPoly.getPath().getArray();
              $("#info").append("coordinates are: Latitude: " + curLatLng + "&lt;br/&gt;");
          });
  
          google.maps.event.addListener(myPoly, 'set_at', function () {
              //alert("drag end");
              var curLatLng1;
              curLatLng1 = myPoly.getPath().getArray();
              $("#info").append("coordinates are: Latitude: " + curLatLng1 + "&lt;br/&gt;");
          });
  
          google.maps.event.addListener(myPoly, 'insert_at', function () {
              //alert("drag end");
              var curLatLng2;
              curLatLng2 = myPoly.getPath().getLength();
              $("#info").append("coordinates are: Latitude: " + curLatLng2 + "&lt;br/&gt;");
          });
  
      }
  
      function removeEventListener() {
          //google.maps.event.clearListeners(map, 'bounds_changed');
      }
      function clearOverlays() {
          setAllMap(null);
      }
      function setAllMap(map) {
          for (var i = 0; i &lt; myMarkers.length; i++) {
              myMarkers[i].setMap(map);
          }
      }
      function isWithinPoly(event) {
          var isWithinPolygon = google.maps.geometry.poly.containsLocation(event.latLng, this);
      }
  
      google.maps.event.addDomListener(window, 'load', initialize); 
  </code></pre>
  
  <p>and html is:</p>
  
  <pre><code>&lt;div id="map-canvas"&gt;&lt;/div&gt;
  &lt;p id="info"&gt;&lt;/p&gt;
  
  &lt;input type="button" onclick="createPoly();" value="draw polygon" /&gt;
  </code></pre>
  
  <hr>
  
  <p>EDIT:</p>
  
  <p>i am using set_at and other two like this but none of the three events are fired.</p>
  
  <pre><code>function markerCoords() {
          var curLatLng = [];
          curLatLng = myPoly.getPath().getArray();
          $("#info").append("coordinates are: Latitude: " + curLatLng + "&lt;br/&gt;");
          //google.maps.event.addListener(myPoly, 'shape_changed', function () {
          google.maps.event.addListener(myPoly, 'dragend', function () {
              alert("drag end");
              var curLatLng;
              curLatLng = myPoly.getPath().getArray();
              $("#info").append("coordinates are: Latitude: " + curLatLng + "&lt;br/&gt;");
          });
  
          google.maps.event.addListener(myPoly, 'set_at', function () {
              alert("set_at");
              var curLatLng;
              curLatLng = myPoly.getPath().getArray();
              $("#info").append("coordinates are: Latitude: " + curLatLng + "&lt;br/&gt;");
          });
  
          google.maps.event.addListener(myPoly, 'insert_at', function () {
              alert("insert_at");
              var curLatLng;
              curLatLng = myPoly.getPath().getArray();
              $("#info").append("coordinates are: Latitude: " + curLatLng + "&lt;br/&gt;");
          });
  
          google.maps.event.addListener(myPoly, 'remove_at', function () {
              alert("remove_at");
              var curLatLng;
              curLatLng = myPoly.getPath().getArray();
              $("#info").append("coordinates are: Latitude: " + curLatLng + "&lt;br/&gt;");
          });
      }
  </code></pre>