Created
August 29, 2010 19:45
-
-
Save cgcardona/556613 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function initialize() { | |
if (GBrowserIsCompatible()) { | |
var firstValue = $('#lat').html() | |
var secondValue = $('#lon').html() | |
var map = new GMap2(document.getElementById("map_canvas")); | |
map.setCenter(new GLatLng(firstValue, secondValue), 16); | |
// Add 10 markers to the map at random locations | |
var bounds = map.getBounds(); | |
var southWest = bounds.getSouthWest(); | |
var northEast = bounds.getNorthEast(); | |
var lngSpan = northEast.lng() - southWest.lng(); | |
var latSpan = northEast.lat() - southWest.lat(); | |
for (var i = 0; i < 10; i++) { | |
var latlng = new GLatLng(southWest.lat() + latSpan * Math.random(), | |
southWest.lng() + lngSpan * Math.random()); | |
map.addOverlay(new GMarker(latlng)); | |
} | |
// Select a map type | |
map.setMapType(G_HYBRID_MAP); | |
map.setUIToDefault(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment