Question: I'm looking to develop/obtain a simple GMaps app for my site that lets the user plot two points and get the distance between the two.

Here is an app that would be perfect for me.
<http://www.daftlogic.com/projects-google-maps-distance-calculator.htm>

I suppose "as the crow flies" could suffice but "suggested route" measurements would be great if possible and too time consuming.

Does anybody know if there is something like this available for download? Also, would it be difficult/time consuming to dev this from scratch?

unfortunately it's only a small piece of a much larger projecet so I won't be able to spend too much time on it.

Any advice greatly appreciated.

Thanks,
Conor

Answer: 
Since Google Maps uses latitude and longitude, you have to do a conversion to your preferred measure system to get the distance as the crow flies.

[Here's one that uses kilometers](http://www.movable-type.co.uk/scripts/latlong.html);

```
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;

```

However, from the Google Maps v2 API you can get directional data from routes. Look into [GDirections](http://code.google.com/intl/sv-SE/apis/maps/documentation/reference.html#GDirections) for the API reference. I've used it in one project, and it works fine.
Don't know if it may helps, but wolfram allows you to query distances (among other features), like:

```
distance from Los Angeles to New York

```

gives you this [answer](http://www.wolframalpha.com/input/?i=distance+from+Los+Angeles+to+New+York)

But you can also query for coordinates, so maybe you can get the coordinates by users click on your map and query something like:

```
distance from 40.34N 74.00W to 40.34N 12.00W

```

Which gives you [this result](http://www.wolframalpha.com/input/?i=distance+from+40.34N+74.00W+to+40.34N+12.00W)