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?
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.
In the above line, the parameter lat and lon are some given value of latitude and longitude of a searched POI.
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).
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.