I need some help. So, i have a js file which contains themes for maps. I want to include it to my another js file,and call all themes to make a option for selecting map theme.
Here is my code for map themes:
green_theme: [{
"featureType": "water",
"elementType": "geometry",
"stylers": [{
"visibility": "on"
}, {
"color": "#aee2e0"
}]
}, {
"featureType": "landscape",
"elementType": "geometry.fill",
"stylers": [{
"color": "#abce83"
}]
}, {
"featureType": "poi",
"elementType": "geometry.fill",
"stylers": [{
"color": "#769E72"
}]
}, {
"featureType": "poi",
"elementType": "labels.text.fill",
"stylers": [{
"color": "#7B8758"
}]
}, {
"featureType": "poi",
"elementType": "labels.text.stroke",
"stylers": [{
"color": "#EBF4A4"
}]
}, {
"featureType": "poi.park",
"elementType": "geometry",
"stylers": [{
"visibility": "simplified"
}, {
"color": "#8dab68"
}]
}, {
"featureType": "road",
"elementType": "geometry.fill",
"stylers": [{
"visibility": "simplified"
}]
}, {
"featureType": "road",
"elementType": "labels.text.fill",
"stylers": [{
"color": "#5B5B3F"
}]
}, {
"featureType": "road",
"elementType": "labels.text.stroke",
"stylers": [{
"color": "#ABCE83"
}]
}, {
"featureType": "road",
"elementType": "labels.icon",
"stylers": [{
"visibility": "off"
}]
}, {
"featureType": "road.local",
"elementType": "geometry",
"stylers": [{
"color": "#A4C67D"
}]
}, {
"featureType": "road.arterial",
"elementType": "geometry",
"stylers": [{
"color": "#9BBF72"
}]
}, {
"featureType": "road.highway",
"elementType": "geometry",
"stylers": [{
"color": "#EBF4A4"
}]
}, {
"featureType": "transit",
"stylers": [{
"visibility": "off"
}]
}, {
"featureType": "administrative",
"elementType": "geometry.stroke",
"stylers": [{
"visibility": "on"
}, {
"color": "#87ae79"
}]
}, {
"featureType": "administrative",
"elementType": "geometry.fill",
"stylers": [{
"color": "#7f2200"
}, {
"visibility": "off"
}]
}, {
"featureType": "administrative",
"elementType": "labels.text.stroke",
"stylers": [{
"color": "#ffffff"
}, {
"visibility": "on"
}, {
"weight": 4.1
}]
}, {
"featureType": "administrative",
"elementType": "labels.text.fill",
"stylers": [{
"color": "#495421"
}]
}, {
"featureType": "administrative.neighborhood",
"elementType": "labels",
"stylers": [{
"visibility": "off"
}]
}],
black_theme: [{
"stylers": [{
"hue": "#ff1a00"
}, {
"invert_lightness": true
}, {
"saturation": -100
}, {
"lightness": 33
}, {
"gamma": 0.5
}]
}, {
"featureType": "water",
"elementType": "geometry",
"stylers": [{
"color": "#2D333C"
}]
}],
blue_theme: [{
"featureType": "landscape.natural",
"elementType": "geometry.fill",
"stylers": [{
"visibility": "on"
}, {
"color": "#e0efef"
}]
}, {
"featureType": "poi",
"elementType": "geometry.fill",
"stylers": [{
"visibility": "on"
}, {
"hue": "#1900ff"
}, {
"color": "#c0e8e8"
}]
}, {
"featureType": "road",
"elementType": "geometry",
"stylers": [{
"lightness": 100
}, {
"visibility": "simplified"
}]
}, {
"featureType": "road",
"elementType": "labels",
"stylers": [{
"visibility": "off"
}]
}, {
"featureType": "transit.line",
"elementType": "geometry",
"stylers": [{
"visibility": "on"
}, {
"lightness": 700
}]
}, {
"featureType": "water",
"elementType": "all",
"stylers": [{
"color": "#7dcdcd"
}]
}],
retro_theme: [{
"featureType": "administrative",
"stylers": [{
"visibility": "off"
}]
}, {
"featureType": "poi",
"stylers": [{
"visibility": "simplified"
}]
}, {
"featureType": "road",
"elementType": "labels",
"stylers": [{
"visibility": "simplified"
}]
}, {
"featureType": "water",
"stylers": [{
"visibility": "simplified"
}]
}, {
"featureType": "transit",
"stylers": [{
"visibility": "simplified"
}]
}, {
"featureType": "landscape",
"stylers": [{
"visibility": "simplified"
}]
}, {
"featureType": "road.highway",
"stylers": [{
"visibility": "off"
}]
}, {
"featureType": "road.local",
"stylers": [{
"visibility": "on"
}]
}, {
"featureType": "road.highway",
"elementType": "geometry",
"stylers": [{
"visibility": "on"
}]
}, {
"featureType": "water",
"stylers": [{
"color": "#84afa3"
}, {
"lightness": 52
}]
}, {
"stylers": [{
"saturation": -17
}, {
"gamma": 0.36
}]
}, {
"featureType": "transit.line",
"elementType": "geometry",
"stylers": [{
"color": "#3f518c"
}]
}]
And here is my code for another js file:
var options = {
zoom: 6,
mapTypeId: google.maps.MapTypeId.ROADMAP,
//mapTypeId: google.maps.MapTypeId.HYBRID ,
mapTypeControl: true,
streetViewControl: true,
center: new google.maps.LatLng(14.435947810360242, 121.01270109415054),
zoomControl: true,
zoomControlOptions: {
style: google.maps.ZoomControlStyle.SMALL,
position: google.maps.ControlPosition.RIGHT_BOTTOM
}
};
//refresh map
var map = new google.maps.Map(document.getElementById('map'), options);
Thanks in Advance!