Skip to content

Instantly share code, notes, and snippets.

@greywillfade
Created January 23, 2015 16:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save greywillfade/96f186ecb64cd5cfed86 to your computer and use it in GitHub Desktop.
Save greywillfade/96f186ecb64cd5cfed86 to your computer and use it in GitHub Desktop.
Sample Google Map styling
<script src="https://maps.googleapis.com/maps/api/js?v=3.exp&key=APIKEYHERE"></script>
<script type="text/javascript">
var map;
var maplocation = new google.maps.LatLng(LAT, LONG);
function initialize() {
var atlasStyles = [
{
featureType: 'landscape.natural',
stylers: [
{ lightness: 100 }
]
},{
featureType: 'landscape.man_made',
stylers: [
{ lightness: 100 }
]
},{
featureType: 'road',
elementType: 'geometry.fill',
stylers: [
{ color: '#cecece' },
{ visibility: 'on' }
]
},{
featureType: 'road',
elementType: 'geometry.stroke',
stylers: [
{ visibility: "off" },
{ lightness: 40 }
]
},{
featureType: 'water',
elementType: 'geometry',
stylers: [
{ color: '#00A1E0' },
{ lightness: 65 }
]
}
];
var mapOptions = {
zoom: 13,
draggable: false,
scrollwheel: false,
center: maplocation,
mapTypeControlOptions: {
mapTypeIds: []
}
};
map = new google.maps.Map(document.getElementById('map-canvas'), mapOptions);
var image = {
url: '../img/mappin.png',
scaledSize: new google.maps.Size(30, 44),
};
var custMarker = new google.maps.Marker({
position: maplocation,
map: map,
icon: image
});
var LSRoadMapType = new google.maps.StyledMapType(atlasStyles);
map.mapTypes.set('usroadatlas', LSRoadMapType);
map.setMapTypeId('usroadatlas');
}
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