Skip to content

Instantly share code, notes, and snippets.

@JustinK
Created September 24, 2015 18:35
Show Gist options
  • Save JustinK/50ce8a6a2c4b11e9e547 to your computer and use it in GitHub Desktop.
Save JustinK/50ce8a6a2c4b11e9e547 to your computer and use it in GitHub Desktop.
google.maps.event.addDomListener(window, 'load', initializeMap);
function initializeMap() {
initializeDatePicker();
var mapOptions = {
mapTypeId: google.maps.MapTypeId.ROADMAP,
mapTypeControl: false
};
var map = new google.maps.Map(document.getElementById('map-canvas'), mapOptions);
var customStyles = [
{
"featureType": "landscape",
"stylers": [
{
"hue": "#FFBB00"
},
{
"saturation": 43.400000000000006
},
{
"lightness": 37.599999999999994
},
{
"gamma": 1
}
]
},
{
"featureType": "road.highway",
"stylers": [
{
"hue": "#FFC200"
},
{
"saturation": -61.8
},
{
"lightness": 45.599999999999994
},
{
"gamma": 1
}
]
},
{
"featureType": "road.arterial",
"stylers": [
{
"hue": "#FF0300"
},
{
"saturation": -100
},
{
"lightness": 51.19999999999999
},
{
"gamma": 1
}
]
},
{
"featureType": "road.local",
"stylers": [
{
"hue": "#FF0300"
},
{
"saturation": -100
},
{
"lightness": 52
},
{
"gamma": 1
}
]
},
{
"featureType": "water",
"stylers": [
{
"hue": "#0078FF"
},
{
"saturation": -13.200000000000003
},
{
"lightness": 2.4000000000000057
},
{
"gamma": 1
}
]
},
{
"featureType": "poi",
"stylers": [
{
"hue": "#00FF6A"
},
{
"saturation": -1.0989010989011234
},
{
"lightness": 11.200000000000017
},
{
"gamma": 1
}
]
}
];
map.set('styles', customStyles);
var defaultBounds = new google.maps.LatLngBounds(
new google.maps.LatLng(30.35717298822407, -91.2189121240234),
new google.maps.LatLng(30.528847119783435, -90.9442539208984));
map.fitBounds(defaultBounds);
var input = /** @type {HTMLInputElement} */(
document.getElementById('pac-input'));
map.controls[google.maps.ControlPosition.TOP_LEFT].push(input);
var searchBox = new google.maps.places.SearchBox(/** @type {HTMLInputElement} */(input));
google.maps.event.addListener(searchBox, 'places_changed', function() {
refreshResults(searchBox, map);
});
google.maps.event.addListener(map, 'bounds_changed', function() {
var bounds = map.getBounds();
searchBox.setBounds(bounds);
});
google.maps.event.addListener(map, 'idle', function(ev){
var bounds = map.getBounds();
var ne = bounds.getNorthEast();
var sw = bounds.getSouthWest();
console.log(ne + ', ' + sw);
});
$( "#refreshButton" ).on( "click", function() {
refreshResults(searchBox, map);
});
$("#selectAllCheckbox").change(function() {
$('#crimeTypeSelect option').prop('selected', true);
var ischecked= $(this).is(':checked');
console.log(ischecked);
if(!ischecked){
$('#crimeTypeSelect option').not(".default").prop('selected', false);
}else{
$('#crimeTypeSelect option').prop('selected', true);
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment