I'm fairly helpless here guys so hoping for some good ideas easily executed.
Basically I have a form filed tied into Google Maps that will let someone type an address and assign it a lat/long. I'd like to add another one, store both of the inputs people enter and then calculate the "as the crow flies" distance.
I just want to give it an address and have it output how far those addresses are from one another, on a linear line. If it could show that on a map overlay, all the better.
I've been hunting for examples but everything I find has a lot of feature bloat. I just want some simple source code I could study doing this basic type of function.
This is where I am at currently:
http://www.public.asu.edu/~tpeiffer/
Would LOVE any and all thoughts.
Google Maps V2: http://code.google.com/apis/maps/documentation/javascript/v2/reference.html#GLatLng.distanceFrom
Google Maps V3: computeDistanceBetween(from:LatLng, to:LatLng, radius?:number)
http://code.google.com/apis/maps/documentation/javascript/reference.html#spherical
Trevor gave the answer using the Google Maps API, but also check out this question, Calculate distance between two latitude-longitude points? (Haversine formula), and in particular, the link in the accepted answer.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With