Advertisement
Guest User

Untitled

a guest
Nov 21st, 2017
570
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 2.23 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3.   <head>
  4.     <meta name="viewport" content="initial-scale=1.0, user-scalable=no">
  5.     <!-- Latest compiled and minified CSS -->
  6.  
  7. <!-- jQuery library -->
  8.  
  9. <!-- Latest compiled JavaScript -->
  10.     <meta charset="utf-8">
  11.     <title>Simple Polygon</title>
  12.     <style>
  13.       /* Always set the map height explicitly to define the size of the div
  14.        * element that contains the map. */
  15.       #map {
  16.         height: 30%;
  17.         width: 100%;
  18.         text-align: center;
  19.       }
  20.       /* Optional: Makes the sample page fill the window. */
  21.       html, body {
  22.         height: 100%;
  23.         margin: 0;
  24.         padding: 0;
  25.       }
  26.  
  27.  
  28.     </style>
  29.   </head>
  30.   <body>
  31.     <div id="map" style="display: none;"></div>
  32.     <script>
  33.  
  34.       // This example creates a simple polygon representing the Bermuda Triangle.
  35.  
  36.       function initMap() {
  37.         var map = new google.maps.Map(document.getElementById('map'), {
  38.           zoom: 5,
  39.           center: {lat: 24.886, lng: -70.268},
  40.           mapTypeId: 'terrain'
  41.         });
  42.  
  43.         // Define the LatLng coordinates for the polygon's path.
  44.         var triangleCoords = [
  45.           {lat: 25.774, lng: -80.190},
  46.           {lat: 18.466, lng: -66.118},
  47.           {lat: 32.321, lng: -64.757},
  48.           {lat: 25.774, lng: -80.190}
  49.         ];
  50.  
  51.         // Construct the polygon.
  52.         var bermudaTriangle = new google.maps.Polygon({
  53.           paths: triangleCoords,
  54.           strokeColor: '#FF0000',
  55.           strokeOpacity: 0.8,
  56.           strokeWeight: 2,
  57.           fillColor: '#FF0000',
  58.           fillOpacity: 0.35
  59.         });
  60.         bermudaTriangle.setMap(map);
  61.       }
  62.     </script>
  63.     <script async defer
  64.    src="https://maps.googleapis.com/maps/api/js?key=AIzaSyCwADgRtnxY8GS26ySkPXGawurjy3oe_eI&callback=initMap">
  65.     </script>
  66.  
  67.     <button class="hidden-print" onclick="ToExecuteAfterLoaded()">Print this page</button>
  68.  
  69. <style type="text/css" media="print">
  70.   @page { size: landscape; }
  71. </style>
  72.  
  73. <script>
  74. function ToExecuteAfterLoaded() {
  75.     document.getElementById("map").style.display = "block";
  76.     if(google && google.maps){
  77.         window.print();
  78. }
  79.    
  80.     document.getElementById("map").style.display = "none";
  81. }
  82. </script>
  83.   </body>
  84. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement