Google maps status plan

Membuat garis-garis lurus seperti jalur pesawat terbang di google maps api adalah seperti pada contoh berikut.


 var map;
    function initMap() {
        var opts = { 'center': new google.maps.LatLng(0.5769167874644966, 123.01858018012717), 'zoom': 12, 'mapTypeId': google.maps.MapTypeId.ROADMAP }
        map = new google.maps.Map(document.getElementById('map'), opts);

                  var myPlanCoordinates = [
            {lat: 0.5763202946497464, lng: 123.04684625421146}, {lat: 0.5666596898692929, lng: 123.06855912957963}, {lat: 0.5436761527824713, lng: 123.06216703210453}, {lat: 0.5498483970634752, lng: 123.05068775290499}, {lat: 0.5763202946497464, lng: 123.04684625421146}          ];
          
          var myPath = new google.maps.Polyline({
            path: myPlanCoordinates,
            geodesic: true,
            strokeColor: '#FF0000',
            strokeOpacity: 1.0,
            strokeWeight: 2
          });

          myPath.setMap(map);    
    }
    
    google.maps.event.addDomListener(window, 'load', init_map);

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s