static-set-lines

static-set-lines

by santosh_patnala

HTML

<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false"></script>
<div id="map-canvas"></div>
</body>

CSS

html, body, #map-canvas {
        height: 100%;
        margin: 0px;
        padding: 0px
      }

JavaScript

function initialize() {
            var mapOptions = {
                zoom: 5,
                center: new google.maps.LatLng(17.397821, 78.479354),
                mapTypeId: google.maps.MapTypeId.ROADMAP
            };
            var map = new google.maps.Map(document.getElementById('map-canvas'), mapOptions);
            var lines = [
            new google.maps.LatLng(18.070145, 78.344771),
            new google.maps.LatLng(17.731682, 78.256880),
            new google.maps.LatLng(16.731682, 78.439528)
            ];
            var flightPath = new google.maps.Polyline({
                path: lines,
                geodesic: true,
                strokeColor: '#FF0000',
                strokeOpacity: 0.5,
                strokeWeight: 6
            });

            flightPath.setMap(map);
        }
        google.maps.event.addDomListener(window, 'load', initialize);