I have one Location (lat and long) and I want to find the next location(lat and long), which is 1 km away in 180 degree (in south) from my location(lat and long). Can you give me and algorithm or function?
相关问题
- Delete Messages from a Topic in Apache Kafka
- Jackson Deserialization not calling deserialize on
- How can I create this custom Bottom Navigation on
- How to maintain order of key-value in DataFrame sa
- StackExchange API - Deserialize Date in JSON Respo
For an easy solution have a look at the SimpleLatLng library and its travel() method:
You just give it the starting point, direction, distance and unit and you get the calculated location. You'll need to get the complete library as this method uses some classes declared by the library. It has some other useful calculations too.
It's available under the Apache 2.0 License.
Start with the Rosetta code implementation in Java:
If you know that
lon1 == lon2
, then an awful lot of this code drops right out, becausedLon == 0
:(which should be familiar as the
length = Radius * angle in radians
formula)So, if you know that
R = 6372.8
, and your desired result is1
, then it is easy to come up with a value fordLat
:In other words, simply subtract
1.0 / 6372.8
from your current latitude (and remember to handle points of latitude less than180 - 1.0 / 6372.8
carefully).Moving due South, also due North, makes the calculation simple as it avoids using longitude. See
1 kms is equal to 0.0088339 degrees.
So in the the Northern hemisphere subtract 0.0088339 from the latitude of location and leave longitude as is. For Southern Hemisphere add 0.0088339.