polygon-simple.html
author sl
Wed, 09 Apr 2014 12:36:39 +0200
changeset 0 5ecce0e1ef52
permissions -rw-r--r--
Various gmaps HTML pages and scripts.
     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>Simple Polygon</title>
     7     <link href="/maps/documentation/javascript/examples/default.css" rel="stylesheet">
     8     <script src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false"></script>
     9     <script>
    10 function initialize() {
    11   var myLatLng = new google.maps.LatLng(24.886436490787712, -70.2685546875);
    12   var mapOptions = {
    13     zoom: 5,
    14     center: myLatLng,
    15     mapTypeId: google.maps.MapTypeId.TERRAIN
    16   };
    17 
    18   var bermudaTriangle;
    19 
    20   var map = new google.maps.Map(document.getElementById('map-canvas'),
    21       mapOptions);
    22 
    23   var triangleCoords = [
    24       new google.maps.LatLng(25.774252, -80.190262),
    25       new google.maps.LatLng(18.466465, -66.118292),
    26       new google.maps.LatLng(32.321384, -64.75737),
    27       new google.maps.LatLng(25.774252, -80.190262)
    28   ];
    29 
    30   // Construct the polygon
    31   bermudaTriangle = new google.maps.Polygon({
    32     paths: triangleCoords,
    33     strokeColor: '#FF0000',
    34     strokeOpacity: 0.8,
    35     strokeWeight: 2,
    36     fillColor: '#FF0000',
    37     fillOpacity: 0.35
    38   });
    39 
    40   bermudaTriangle.setMap(map);
    41 }
    42 
    43 google.maps.event.addDomListener(window, 'load', initialize);
    44 
    45     </script>
    46   </head>
    47   <body>
    48     <div id="map-canvas"></div>
    49   </body>
    50 </html>