Get latitude & longitude given current point, distance and bearing (or angle)

Hi, there

Is there any method in TomTomMap Android SDK that returns a new latitude & longitude (preferably LatLng instance but not a must) given original latitude & longitude, distance, & angle?

I searched in the library and I was not able to find any method like that.

Or do I need to implement a new method (and mathematical calculations) myself?

Any suggestions/recommendations would be nice

Hi.

As far as I know, we don’t have such functionality in our SDK. You will have to implement it on your own, or you can find a library with such features.

Regards,
Mateusz

Hi, Mateusz

Yes, and thank you for helping me again

  1. First I created a LatLng instance as below.

LatLng position1 = new LatLng(lat, lon);

In the above line, the parameter lat and lon are some given value of latitude and longitude of a searched POI.

  1. Then I am trying to create another LatLng instance, and want to call it as position2.

However, the latitude and longitude of position2 are not known yet. What I know is position2 is X km (or miles) away at Y degree angle from the position1.

So In order to create new LatLng instance of position2, I need to find out its latitude and longitude based on the position1’s latitude, longitude, X distance, and Y angle.

And I am trying to find a way to do this with TomTom sdk libs (or others).

If you have any question, please let me know.

Bests

oh okay, got it.

Kyungsuk

Hi.

There is a Turf.js library which we are using in one of our Maps SDK for Web tutorial. It contains a lot of geospatial algorithms like this one: https://turfjs.org/docs/#destination.
Maybe there is a port on Android available.

Regards,
Mateusz

1 Like

Great. Thanks. I’ll take a look at it

1 Like

Interesting question! May I ask for what type of application you would like to build this? Is it for boats or airplanes?