Created
June 3, 2013 15:12
-
-
Save edwinschaap/5698890 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
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script> | |
<div id="map" style="width:100%px;height:400px;" class="google_map full"></div> | |
<script type="text/javascript"> | |
var latlng = new google.maps.LatLng(0, 0); | |
var myOptions = { | |
zoom: 16, | |
center: latlng, | |
scrollwheel: true, | |
scaleControl: false, | |
disableDefaultUI: false, | |
mapTypeId: google.maps.MapTypeId.ROADMAP | |
}; | |
var map = new google.maps.Map(document.getElementById("map"), | |
myOptions); | |
var geocoder_map = new google.maps.Geocoder(); | |
var address = 'Amsterdam'; | |
geocoder_map.geocode({ | |
'address': address | |
}, function(results, status) { | |
if (status == google.maps.GeocoderStatus.OK) { | |
map.setCenter(results[0].geometry.location); | |
var marker = new google.maps.Marker({ | |
map: map, | |
position: map.getCenter() | |
}); | |
var contentString = 'Amsterdam'; | |
var infowindow = new google.maps.InfoWindow({ | |
content: contentString | |
}); | |
google.maps.event.addListener(marker, 'click', function() { | |
infowindow.open(map, marker); | |
}); | |
} else { | |
alert("Geocode was not successful for the following reason: " + status); | |
} | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment