Last active
March 23, 2018 08:20
-
-
Save ttristan/052b395f7b495a9d110b536d8a87866b to your computer and use it in GitHub Desktop.
This file contains hidden or 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
const GoogleMapsLoader = require('google-maps'); | |
GoogleMapsLoader.KEY = '<KEY>'; | |
GoogleMapsLoader.LANGUAGE = 'en'; | |
GoogleMapsLoader.REGION = 'DE'; | |
GoogleMapsLoader.VERSION = '1'; | |
GoogleMapsLoader.LIBRARIES = ['geometry', 'places']; | |
// init the map | |
GoogleMapsLoader.load(function(google) { | |
const id = document.getElementById('googleMap'); | |
const options = { | |
mapTypeControlOptions: { | |
mapTypeIds: ['Styled'] | |
}, | |
zoom: 12, | |
center: {lat: 51.2598529, lng: 6.8148163}, | |
disableDefaultUI: true, | |
scaleControl: false, | |
scrollwheel: false, | |
navigationControl: false, | |
mapTypeControl: false, | |
mapTypeId: 'Styled' | |
} | |
const styles = | |
[{"featureType":"administrative","elementType":"labels.text.fill","stylers":[{"color":"#444444"}]},{"featureType":"administrative.country","elementType":"geometry.stroke","stylers":[{"visibility":"simplified"}]},{"featureType":"landscape","elementType":"all","stylers":[{"color":"#f2f2f2"}]},{"featureType":"poi","elementType":"all","stylers":[{"visibility":"off"}]},{"featureType":"poi.business","elementType":"geometry.stroke","stylers":[{"visibility":"on"}]},{"featureType":"road","elementType":"all","stylers":[{"saturation":-100},{"lightness":45}]},{"featureType":"road","elementType":"geometry.stroke","stylers":[{"visibility":"simplified"}]},{"featureType":"road.highway","elementType":"all","stylers":[{"visibility":"simplified"}]},{"featureType":"road.arterial","elementType":"labels.icon","stylers":[{"visibility":"off"}]},{"featureType":"transit","elementType":"all","stylers":[{"visibility":"off"}]},{"featureType":"transit","elementType":"geometry.stroke","stylers":[{"visibility":"simplified"}]},{"featureType":"water","elementType":"all","stylers":[{"color":"#afb9c2"},{"visibility":"on"}]}]; | |
const map = new google.maps.Map(id, options); | |
const styledMapType = new google.maps.StyledMapType(styles, { name: 'Styled' }); | |
map.mapTypes.set('Styled', styledMapType); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment