Skip to content

Instantly share code, notes, and snippets.

@dbridgman
Created October 26, 2015 11:28
Show Gist options
  • Save dbridgman/b72075548dc8f2b6345e to your computer and use it in GitHub Desktop.
Save dbridgman/b72075548dc8f2b6345e to your computer and use it in GitHub Desktop.
<!-- BELOW IS THE CONTAIN THAT HOLDS THE MAP, YOU CAN DICTATE THE SIZE HERE -->
<div class="mapcontainer"><div id="map-canvas" style="height:400px; width:100%;"></div></div>
<script>
function initialize() {
// THE myLatlng VARIABLE DEFINES WHERE THE RADIUS IS GOING TO LAND
var myLatlng = new google.maps.LatLng(52.487600, -1.892821);
// THE myHome VARIABLE DEFINES WHERE THE PIN IS GOING TO LAND
var myHome = new google.maps.LatLng(52.699866, -1.991307);
var mapOptions = {
// THE ZOOM BELOW CONTROLS HOW FAR OUT THE MAP LOADS, AS WELL AS HOW MUCH YOU CAN ZOOM IN/OUT
zoom:9,
minZoom: 6,
maxZoom: 17,
center: myLatlng,
mapTypeId: google.maps.MapTypeId.ROADMAP,
// Set the Map Controls
overviewMapControl:true,
mapTypeControl:false
}
var map = new google.maps.Map(document.getElementById('map-canvas'), mapOptions);
// BELOW IS THE FILE PATH TO YOUR IMAGE, ENSURE THE SIZE OF THE ICON IS DEFINED AS WELL
var image = new google.maps.MarkerImage("/wp-content/themes/adf/images/marker.png", null, null, null, new google.maps.Size(69,44));
var marker = new google.maps.Marker({
position: myHome,
// animation:google.maps.Animation.BOUNCE,
icon:image,
map: map,
title: 'ADF Scale'
});
// The Radius Band:
// BELOW CONTROLS THE AESTHETICS OF THE MAP
var local = new google.maps.Circle({
center:myLatlng,
radius:20000,
strokeColor:"#0000FF",
strokeOpacity:0.8,
strokeWeight:0,
fillColor:"#2A97DA",
fillOpacity:0.3
});
local.setMap(map);
google.maps.event.addListener(local, 'click', function(ev){
band0infowindow.setPosition(ev.latLng);
band0infowindow.open(map);
});
}
google.maps.event.addDomListener(window, 'load', initialize);
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment