If you need calculate the distance between 2 points ( in polar coordinates, like google maps style ) feel free to use this function:

- Code: Select all
`{NeoBook Function}`

Version=5.80

Language=JScript

Param=[%1]|Text|Lat 1

Param=[%2]|Text|Long 1

Param=[%3]|Text|Lat 2

Param=[%4]|Text|Long 2

{End}

function measure(lat1, lon1, lat2, lon2) {

var R = 6378.137;

var dLat = (lat2 - lat1) * Math.PI / 180;

var dLon = (lon2 - lon1) * Math.PI / 180;

var a = Math.sin(dLat/2) * Math.sin(dLat/2) + Math.cos(lat1 * Math.PI / 180) * Math.cos(lat2 * Math.PI / 180) * Math.sin(dLon/2) * Math.sin(dLon/2);

var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a));

var d = R * c;

return d * 1000;

}

var lat1 = [%1];

var lon1 = [%2];

var lat2 = [%3];

var lon2 = [%4];

nbSetVar ('result', measure(lat1,lon1,lat2,lon2));

Obviously, distance is the measure of the rect line that join both points.

No turns of streets, or curves of the rute, etc

Greetings from Buenos Aires,

David de Argentina