Skip to content

Instantly share code, notes, and snippets.

@csessig86
Created June 7, 2016 19:48
Show Gist options
  • Save csessig86/93608cb82158bf8a2f6d62a29f03bda8 to your computer and use it in GitHub Desktop.
Save csessig86/93608cb82158bf8a2f6d62a29f03bda8 to your computer and use it in GitHub Desktop.
HO GA maps
var map;
var geocoder;
Event.observe(window, 'load', codeAddress);
function initialize(latlng) {
latlng = new google.maps.LatLng(41.6591, -91.5319);
var myOptions = {
zoom: 15,
center: latlng,
disableDefaultUI: true,
zoomControl: true,
zoomControlOptions: { style: google.maps.ZoomControlStyle.SMALL },
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map($("place-map"), myOptions);
var marker = new google.maps.Marker({
map: map,
position: latlng
});
}
function codeAddress() {
geocoder = new google.maps.Geocoder();
var address = "123 S. Linn St. Iowa City, IA 52240";
geocoder.geocode( { 'address': address}, function(results, status) {
if (status == google.maps.GeocoderStatus.OK) {
initialize(results[0].geometry.location);
} else {
alert("Geocode was not successful for the following reason: " + status);
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment