geometry encoding methods

Encode map data.

var poly;

function initialize() {
  var mapOptions = {
    zoom: 14,
    center: new google.maps.LatLng(34.3664951, -89.5192484),
    mapTypeId: google.maps.MapTypeId.ROADMAP
  };

  var map = new google.maps.Map(document.getElementById(\'map-canvas\'),
    mapOptions);

  var polyOptions = {
    strokeColor: \'#000000\',
    strokeOpacity: 1.0,
    strokeWeight: 3,
    map: map
  };
  poly = new google.maps.Polyline(polyOptions);

   Add a listener for the click event
  google.maps.event.addListener(map, \'click\', addLatLng);
}

**
 * Handles click events on a map, and adds a new point to the Polyline.
 * Updates the encoding text area with the path\'s encoded values.
 *
function addLatLng(event) {
  var path = poly.getPath();
   Because path is an MVCArray, we can simply append a new coordinate
   and it will automatically appear
  path.push(event.latLng);

   Update the text field to display the polyline encodings
  var encodeString = google.maps.geometry.encoding.encodePath(path);
  if (encodeString) {
    document.getElementById(\'encoded-polyline\').value = encodeString;
  }
}

google.maps.event.addDomListener(window, \'load\', initialize);