Home
Run >
<!DOCTYPE html> <html> <head><!-- www.techstrikers.com --> <title>Add Custom Style on Map</title> <style> html, body { height: 100%; margin: 0; padding: 0; } #map { height: 99%; width: 99%; } </style> //loading google maps asynchronously <script async defer src="https://maps.googleapis.com/maps/api/js? signed_in=true&callback=initialize"> </script> <script> function initialize() { var customMapType = new google.maps.StyledMapType([ { stylers: [ {hue: '#890000'}, {visibility: 'simplified'}, {gamma: 0.7}, {weight: 0.5} ] }, { elementType: 'labels', stylers: [{visibility: 'on'}] }, { featureType: 'water', stylers: [{color: '#18A9DE'}] } ], { name: 'Custom Style' }); var customMapTypeId = 'custom_style'; var lat_lng = {lat: 20.08672, lng: 78.42444}; var map = new google.maps.Map(document.getElementById('map'), { zoom: 6, center: lat_lng, // Brooklyn. mapTypeControlOptions: { mapTypeIds: [google.maps.MapTypeId.ROADMAP, customMapTypeId] } }); map.mapTypes.set(customMapTypeId, customMapType); map.setMapTypeId(customMapTypeId); } </script> </head> <body> <div id="map"></div> </body> </html>