这里latlng1的类型是google.maps.LatLng;
function get_distance(latlng1, latlng2)
{
var radLat1 = latlng1.lat() * Math.PI / 180;
var radLat2 = latlng2.lat() * Math.PI / 180;
var a = radLat1 - radLat2;
var b = (latlng1.lng() * Math.PI / 180) - (latlng2.lng() * Math.PI / 180);
var s = 2 * Math.asin(Math.sqrt(Math.pow(Math.sin(a/2),2) +
Math.cos(radLat1) * Math.cos(radLat2) * Math.pow(Math.sin(b/2),2)));
s = s * 6378.137;
return s;
}