Advertisement
przemosk

Untitled

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