1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
| <!DOCTYPE html> <html> <head> <meta name="viewport" content="initial-scale=1.0, user-scalable=no"> <meta charset="utf-8"> <title>Simple Polylines</title> <style> * element that contains the map. */ #map { height: 100%; } html, body { height: 100%; } </style> </head> <body> <div id="map"></div> <script> function initMap() { var map = new google.maps.Map(document.getElementById('map'), { zoom: 3, center: {lat: 24.977179, lng: 121.312848}, mapTypeId: 'ROADMAP', zoom: 13, });
var bikeLaneCoordinates = [ {lat: 24.977685, lng: 121.310424}, {lat: 24.977179, lng: 121.312848}, {lat: 24.977879, lng: 121.317708}, {lat: 24.978132, lng: 121.319951} ]; var bikeLanePath = new google.maps.Polyline({ path: bikeLaneCoordinates, geodesic: true, strokeColor: '#FF0000', strokeOpacity: 1.0, strokeWeight: 2, editable: true, draggable: true });
bikeLanePath.setMap(map);
} </script> <script async defer src="https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY&callback=initMap"> </script> </body> </html>
|