In V3, it simply adds the geodesic: true
parameter to your Polyline.
Demo http://jsfiddle.net/yV6xv/20/ Click on the map to determine the endpoints of the path
var myLine = new google.maps.Polyline({ map: map, geodesic: true }); var path = []; google.maps.event.addListener(map, 'click', function(event) { new google.maps.Marker({map:map,position:event.latLng}); path.push(event.latLng); myLine.setPath(path); });

source share