Google Maps


Simple Map

new GMaps({
  div: '#map',
  lat: -12.043333,
  lng: -77.028333
});

Markers

map.addMarker({
  lat: -12.043333,
  lng: -77.028333,
  title: 'Lima',
  click: function(e) {
    alert('You clicked in this marker');
  }
});

If you want to show an Info Window, you must add:

infoWindow: {
  content: '<p>HTML Content</p>'
}

Geolocation

GMaps.geolocate({
  success: function(position) {
    map.setCenter(position.coords.latitude, position.coords.longitude);
  },
  error: function(error) {
    alert('Geolocation failed: '+error.message);
  },
  not_supported: function() {
    alert("Your browser does not support geolocation");
  },
  always: function() {
    alert("Done!");
  }
});

Static Map

url = GMaps.staticMapURL({
  size: [610, 300],
  lat: -12.043333,
  lng: -77.028333
});

$('<img/>').attr('src', url)
  .appendTo('#map');

Street View Panoramas

panorama = GMaps.createPanorama({
  el: '#panorama',
  lat : 42.3455,
  lng : -71.0983
});