Advertisement
Guest User

Untitled

a guest
Jan 29th, 2015
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 7.97 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4.     <title>Simple styled maps</title>
  5.     <style>
  6.         html, body, #map-canvas {
  7.             height: 100%;
  8.             margin: 0px;
  9.             padding: 0px
  10.         }
  11.     </style>
  12.     <script src="https://maps.googleapis.com/maps/api/js?v=3.exp&signed_in=true"></script>
  13.     <script>
  14.         var map;
  15.         var brooklyn = new google.maps.LatLng(40.6743890, -73.9455);
  16.  
  17.         var MY_MAPTYPE_ID = 'custom_style';
  18.  
  19.         function initialize() {
  20.  
  21.             var featureOpts = [
  22.                 {
  23.                     stylers: [
  24.                         { hue: '#f2842b' },
  25.                         { visibility: 'simplified' },
  26.                         { gamma: 0.8 },
  27.                         { weight: 0.8 }
  28.                     ]
  29.                 },
  30.  
  31.                 {
  32.                     elementType: 'labels',
  33.                     stylers: [
  34.                         {
  35.                             visibility: 'on'
  36.                         }
  37.                     ]
  38.                 },
  39.  
  40.                 {
  41.                     elementType: 'labels.text',
  42.                     stylers: [
  43.                         {
  44.                             visibility: 'on',
  45.                             color: "#000000"
  46.                         }
  47.                     ]
  48.                 },
  49.  
  50.                 {
  51.                     featureType: 'water',
  52.                     stylers: [
  53.                         {
  54.                             color: '#5eb9ff',
  55.                             gamma: 0.3, // gamma
  56.                             hue: '#FF0000', // odcień
  57.                             lightness: 65, //jasność, (-100,100)
  58.                             saturation: 30, // saturacja (-100, 100)
  59.                             weight: 10
  60.                         }
  61.                     ]
  62.                 },
  63.  
  64.                 {
  65.                     featureType: 'road', //tutaj wrzucasz typ
  66.                     stylers: [
  67.                         {
  68.                             color: '#ffffff', // kolor
  69.                             gamma: 0.8, // gamma
  70.                             hue: '#FF0000', // odcień
  71.                             lightness: 80, //jasność, (-100,100)
  72.                             saturation: 30, // saturacja (-100, 100)
  73.                             weight: 10 //pixels
  74.                         }
  75.                     ],
  76.                     elementType: 'labels.text',         //tutaj zaczyna się konfiguracji nazwy ulic
  77.                     stylers: [
  78.                         {
  79.                             visibility: 'on',
  80.                             color: "#000000"
  81.                         }
  82.                     ]
  83.                 },
  84.  
  85.                 {
  86.                     featureType: 'administrative.land_parcel', //tutaj wrzucasz typ
  87.                     stylers: [
  88.                         {
  89.                             color: '#4a4a4a', // kolor
  90.                             gamma: 0.8, // gamma
  91.                             hue: '#FF0000', // odcień
  92.                             lightness: 80, //jasność, (-100,100)
  93.                             saturation: 30, // saturacja (-100, 100)
  94.                             weight: 10 //pixels
  95.                         }
  96.                     ]
  97.                 },
  98.  
  99.                 {
  100.                     featureType: 'administrative.locality', //tutaj wrzucasz typ
  101.                     stylers: [
  102.                         {
  103.                             color: '#1484d8', // kolor
  104.                             gamma: 0.8, // gamma
  105.                             hue: '#FF0000', // odcień
  106.                             lightness: 80, //jasność, (-100,100)
  107.                             saturation: 30, // saturacja (-100, 100)
  108.                             weight: 3 //pixels
  109.                         }
  110.                     ]
  111.                 },
  112.  
  113.                 {
  114.                     featureType: 'landscape', //tutaj wrzucasz typ
  115.                     stylers: [
  116.                         {
  117.                             color: '#f0ede5', // kolor
  118.                             gamma: 0.8, // gamma
  119.                             hue: '#FF0000', // odcień
  120.                             lightness: 80, //jasność, (-100,100)
  121.                             saturation: 30, // saturacja (-100, 100)
  122.                             weight: 3 //pixels
  123.                         }
  124.                     ]
  125.                 },
  126.  
  127.                 {
  128.                     featureType: 'landscape.man_made', //tutaj wrzucasz typ
  129.                     stylers: [
  130.                         {
  131.                             color: '#dfdbd4', // kolor
  132.                             gamma: 0.8, // gamma
  133.                             hue: '#FF0000', // odcień
  134.                             lightness: 80, //jasność, (-100,100)
  135.                             saturation: 30, // saturacja (-100, 100)
  136.                             weight: 3 //pixels
  137.                         }
  138.                     ]
  139.                 },
  140.  
  141.                 {
  142.                     featureType: 'poi', //tutaj wrzucasz typ
  143.                     stylers: [
  144.                         {
  145.                             color: '#b3dd9b', // kolor
  146.                             gamma: 0.1, // gamma
  147.                             hue: '#FF0000', // odcień
  148.                             lightness: 80, //jasność, (-100,100)
  149.                             saturation: 30, // saturacja (-100, 100)
  150.                             weight: 3 //pixels
  151.                         }
  152.                     ]
  153.                 },
  154.  
  155.                 {
  156.                     featureType: 'poi.attraction', //tutaj wrzucasz typ
  157.                     stylers: [
  158.                         {
  159.                             color: '#d2e4c8', // kolor
  160.                             gamma: 0.1, // gamma
  161.                             hue: '#FF0000', // odcień
  162.                             lightness: 80, //jasność, (-100,100)
  163.                             saturation: 30, // saturacja (-100, 100)
  164.                             weight: 3 //pixels
  165.                         }
  166.                     ]
  167.                 },
  168.                 {
  169.                     featureType: 'poi.park', //tutaj wrzucasz typ
  170.                     stylers: [
  171.                         {
  172.                             color: '#d2e4c8', // kolor
  173.                             gamma: 0.1, // gamma
  174.                             hue: '#FF0000', // odcień
  175.                             lightness: 80, //jasność, (-100,100)
  176.                             saturation: 30, // saturacja (-100, 100)
  177.                             weight: 3 //pixels
  178.                         }
  179.                     ]
  180.                 },
  181.  
  182.  
  183.                 {
  184.                     featureType: 'transit.line', //tutaj wrzucasz typ
  185.                     stylers: [
  186.                         {
  187.                             color: '#ffba7e', // kolor
  188.                             gamma: 0.1, // gamma
  189.                             hue: '#FF0000', // odcień
  190.                             lightness: 80, //jasność, (-100,100)
  191.                             saturation: 30, // saturacja (-100, 100)
  192.                             weight: 3 //pixels
  193.                         }
  194.                     ]
  195.                 }
  196.  
  197.             ]
  198.             var mapOptions = {
  199.                 zoom: 12,
  200.                 center: brooklyn,
  201.                 mapTypeControlOptions: {
  202.                     mapTypeIds: [google.maps.MapTypeId.ROADMAP, MY_MAPTYPE_ID]
  203.                 },
  204.                 mapTypeId: MY_MAPTYPE_ID
  205.             };
  206.  
  207.             map = new google.maps.Map(document.getElementById('map-canvas'),
  208.                     mapOptions);
  209.  
  210.             var styledMapOptions = {
  211.                 name: 'Custom Style'
  212.             };
  213.  
  214.             var customMapType = new google.maps.StyledMapType(featureOpts, styledMapOptions);
  215.  
  216.             map.mapTypes.set(MY_MAPTYPE_ID, customMapType);
  217.         }
  218.  
  219.         google.maps.event.addDomListener(window, 'load', initialize);
  220.  
  221.     </script>
  222. </head>
  223. <body>
  224. <div id="map-canvas"></div>
  225. </body>
  226. </html></html></html></html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement