Advertisement
contatowellington

Untitled

Oct 18th, 2017
424
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.89 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>Custom Markers</title>
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
  6. <meta charset="utf-8">
  7. <style>
  8. /* Always set the map height explicitly to define the size of the div
  9. * element that contains the map. */
  10. #map {
  11. height: 100%;
  12. }
  13. /* Optional: Makes the sample page fill the window. */
  14. html, body {
  15. height: 100%;
  16. margin: 0;
  17. padding: 0;
  18. }
  19. </style>
  20. </head>
  21. <body>
  22. <div id="map"></div>
  23. <script>
  24. var map;
  25. function initMap() {
  26. map = new google.maps.Map(document.getElementById('map'), {
  27. zoom: 16,
  28. center: new google.maps.LatLng(-33.91722, 151.23064),
  29. mapTypeId: 'roadmap'
  30. });
  31.  
  32. var iconBase = 'https://maps.google.com/mapfiles/kml/shapes/';
  33. var icons = {
  34. parking: {
  35. icon: iconBase + 'parking_lot_maps.png'
  36. },
  37. library: {
  38. icon: iconBase + 'library_maps.png'
  39. },
  40. info: {
  41. icon: iconBase + 'info-i_maps.png'
  42. }
  43. };
  44.  
  45. var features = [
  46. {
  47. position: new google.maps.LatLng(-33.91721, 151.22630),
  48. type: 'info'
  49. }, {
  50. position: new google.maps.LatLng(-33.91539, 151.22820),
  51. type: 'info'
  52. }, {
  53. position: new google.maps.LatLng(-33.91747, 151.22912),
  54. type: 'info'
  55. }, {
  56. position: new google.maps.LatLng(-33.91910, 151.22907),
  57. type: 'info'
  58. }, {
  59. position: new google.maps.LatLng(-33.91725, 151.23011),
  60. type: 'info'
  61. }, {
  62. position: new google.maps.LatLng(-33.91872, 151.23089),
  63. type: 'info'
  64. }, {
  65. position: new google.maps.LatLng(-33.91784, 151.23094),
  66. type: 'info'
  67. }, {
  68. position: new google.maps.LatLng(-33.91682, 151.23149),
  69. type: 'info'
  70. }, {
  71. position: new google.maps.LatLng(-33.91790, 151.23463),
  72. type: 'info'
  73. }, {
  74. position: new google.maps.LatLng(-33.91666, 151.23468),
  75. type: 'info'
  76. }, {
  77. position: new google.maps.LatLng(-33.916988, 151.233640),
  78. type: 'info'
  79. }, {
  80. position: new google.maps.LatLng(-33.91662347903106, 151.22879464019775),
  81. type: 'parking'
  82. }, {
  83. position: new google.maps.LatLng(-33.916365282092855, 151.22937399734496),
  84. type: 'parking'
  85. }, {
  86. position: new google.maps.LatLng(-33.91665018901448, 151.2282474695587),
  87. type: 'parking'
  88. }, {
  89. position: new google.maps.LatLng(-33.919543720969806, 151.23112279762267),
  90. type: 'parking'
  91. }, {
  92. position: new google.maps.LatLng(-33.91608037421864, 151.23288232673644),
  93. type: 'parking'
  94. }, {
  95. position: new google.maps.LatLng(-33.91851096391805, 151.2344058214569),
  96. type: 'parking'
  97. }, {
  98. position: new google.maps.LatLng(-33.91818154739766, 151.2346203981781),
  99. type: 'parking'
  100. }, {
  101. position: new google.maps.LatLng(-33.91727341958453, 151.23348314155578),
  102. type: 'library'
  103. }
  104. ];
  105.  
  106. // Create markers.
  107. features.forEach(function(feature) {
  108. var marker = new google.maps.Marker({
  109. position: feature.position,
  110. icon: icons[feature.type].icon,
  111. map: map
  112. });
  113. });
  114. }
  115. </script>
  116. <script async defer
  117. src="https://maps.googleapis.com/maps/api/js?key=AIzaSyC3rcDVwf8dmbKwtr2V0haRhDjAseaSW3Q&callback=initMap">
  118. </script>
  119. </body>
  120. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement