I am developing a desktop application and I have two point (latitude, longitude). How can I get the distance between these two points? I have looked at the API and most of them are javascript or web based. I am not developing a web page. How can I do this in java?
I want a road distance, not a straight distance
If you've got the latitude and longitude, you can use the Haversine formula to calculate the distance between them - assuming you want "straight line" distance.
EDIT: Okay, now you've actually told us what you want, I suspect you need to use the Directions API. You'll need to make a web request to the appropriate URL with your parameters, specifying either XML or JSON output - which you'll then need to parse.
Note that "JSON" != "Javascript-based". Think of JSON as a data serialization format which just happens to be executable Javascript.
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