Spicke

dsfsdf

May 22nd, 2017
779
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 1.57 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3.   <head>
  4.     <meta name="viewport" content="initial-scale=1.0, user-scalable=no">
  5.     <meta charset="utf-8">
  6.     <title>Marker Clustering</title>
  7.     <style>
  8.  
  9.       #map {
  10.         height: 100%;
  11.       }
  12.  
  13.       html, body {
  14.         height: 100%;
  15.         margin: 0;
  16.         padding: 0;
  17.       }
  18.     </style>
  19.   </head>
  20.   <body>
  21.     <div id="map"></div>
  22.     <script>
  23.         function getRandom(){
  24.         var min = 40;
  25.         var max = 60;
  26.         return Math.random()*(max-min)+min;
  27.     }
  28.       function initMap() {
  29.  
  30.         var map = new google.maps.Map(document.getElementById('map'), {
  31.           zoom: 10,
  32.           center: {lat: 56.002853, lng: 53.013463}
  33.         });
  34.         var labels = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
  35.  
  36.         var markers = locations.map(function(location, i) {
  37.           return new google.maps.Marker({
  38.             position: location,
  39.             label: labels[i % labels.length]
  40.           });
  41.         });
  42.  
  43.         var markerCluster = new MarkerClusterer(map, markers,
  44.             {imagePath: 'https://developers.google.com/maps/documentation/javascript/examples/markerclusterer/m'});
  45.       }
  46.  
  47.       var locations = [];
  48.       for(i = 0; i < 1000;i++) locations[i] = {lat: getRandom(), lng: getRandom()};
  49.  
  50.    </script>
  51.     <script src="https://developers.google.com/maps/documentation/javascript/examples/markerclusterer/markerclusterer.js">
  52.     </script>
  53.     <script async defer
  54.    src="https://maps.googleapis.com/maps/api/js?key=AIzaSyA-NSNd-dQHRqtBWly7zA92nue6-d6HrPU&callback=initMap">
  55.     </script>
  56.   </body>
  57. </html>
Advertisement
Add Comment
Please, Sign In to add comment