I am using the code How to move marker in Google Maps API
How can I add to that code to draw a polyline when marker move?
Here is the code:
Code:<script type='text/javascript'>//<![CDATA[ $(window).load(function(){ function initialize() { var myLatLng = new google.maps.LatLng( 50, 50 ), myOptions = { zoom: 4, center: myLatLng, mapTypeId: google.maps.MapTypeId.ROADMAP }, map = new google.maps.Map( document.getElementById( 'map-canvas' ), myOptions ), marker = new google.maps.Marker( {position: myLatLng, map: map} ); marker.setMap( map ); moveMarker( map, marker ); } function moveMarker( map, marker ) { //delayed so you can see it move setTimeout( function(){ marker.setPosition( new google.maps.LatLng( 54, 54 ) ); map.panTo( new google.maps.LatLng( 54, 54 ) ); }, 1500 ); }; initialize(); });//]]> </script>


Reply With Quote

Bookmarks