Skip to content

Instantly share code, notes, and snippets.

@igorpronin
Created April 19, 2016 18:53
Show Gist options
  • Save igorpronin/1cbb1a81ce4b014b7e3fe8aca85b1331 to your computer and use it in GitHub Desktop.
Save igorpronin/1cbb1a81ce4b014b7e3fe8aca85b1331 to your computer and use it in GitHub Desktop.
google map styles from ask-new
;
google.maps.event.addDomListener(window, 'load', init);
function init() {
// Basic options for a simple Google Map
// For more options see: https://developers.google.com/maps/documentation/javascript/reference#MapOptions
var mapOptions = {
// How zoomed in you want the map to start at (always required)
zoom: 15,
// The latitude and longitude to center the map (always required)
center: new google.maps.LatLng(55.7208664, 37.6511556), // New York
disableDefaultUI: true,
zoomControl: true,
scaleControl: false,
scrollwheel: false,
// How you would like to style the map.
// This is where you would paste any style found on Snazzy Maps.
styles:
[
{
"featureType": "landscape",
"elementType": "geometry.fill",
"stylers": [
{
"color": "#d9decd"
}
]
},
{
"featureType": "poi",
"elementType": "all",
"stylers": [
{
"visibility": "off"
}
]
},
{
"featureType": "road",
"elementType": "geometry.fill",
"stylers": [
{
"color": "#bfc5b3"
}
]
},
{
"featureType": "road",
"elementType": "geometry.stroke",
"stylers": [
{
"color": "#bfc5b3"
}
]
},
{
"featureType": "road",
"elementType": "labels.icon",
"stylers": [
{
"visibility": "off"
}
]
},
{
"featureType": "road.highway",
"elementType": "labels.icon",
"stylers": [
{
"visibility": "off"
}
]
},
{
"featureType": "transit",
"elementType": "all",
"stylers": [
{
"visibility": "off"
}
]
},
{
"featureType": "water",
"elementType": "geometry.fill",
"stylers": [
{
"color": "#b3b8a7"
}
]
}
]
};
// Get the HTML DOM element that will contain your map
// We are using a div with id="map" seen below in the <body>
var mapElement = document.getElementById('googlmap');
// Create the Google Map using our element and options defined above
var map = new google.maps.Map(mapElement, mapOptions);
// Let's also add a marker while we're at it
var marker = new google.maps.Marker({
position: new google.maps.LatLng(55.7208664, 37.6511556),
map: map,
icon: '../img/svg/icon-geo-map.svg'
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment