Where in the world are we?

This is a neat question that may interest greenies and gurus. I am trying to find a simple way to compute the distance between two Notes users. Say we could put the exact geographic location (like 26S15, 28E0) in each user’s document, is there a way to convert the difference between two users into miles?

Bottom line, we could support the user of Instant Messaging and Conferencing by telling them how many “miles” they have saved by having a virtual rather than real meeting.

Any takers?

Subject: composite appliation with google maps

Hi

I am really not a guru, but I saw in a demo of a customer a nice tool. He develops a composite application with using google maps. It is a shipping company and the truck-driver have an UMTS or GPS hardware in the truck that sends the currenct position.

The user picks the name from names.nsf and in the other frame it shows him the current position.

In your situation you could pick the current position from sametime-location and give this information to googlemaps that calculate the distance.

I hope you understand my idea…

nice project… unfortunatly i have no develop-knowledge.

Subject: Haversine formula:

What you want is this:

Haversine formula:

R = earth’s radius (mean radius = 6,371km)

Δlat = lat2− lat1

Δlong = long2− long1

a = sin²(Δlat/2) + cos(lat1).cos(lat2).sin²(Δlong/2)

c = 2.atan2(√a, √(1−a))

d = R.c

(Note that angles need to be in radians to pass to trig functions).

JavaScript:

var R = 6371; // km

var dLat = (lat2-lat1).toRad();

var dLon = (lon2-lon1).toRad();

var a = Math.sin(dLat/2) * Math.sin(dLat/2) +

    Math.cos(lat1.toRad()) * Math.cos(lat2.toRad()) * 

    Math.sin(dLon/2) * Math.sin(dLon/2); 

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

var d = R * c;

All of which comes from here: Calculate distance and bearing between two Latitude/Longitude points using haversine formula in JavaScript

The hardest part will be getting users data into the address book or somewhere else easily accessible,

Yours,

Pete Spoors