-1

I got severel points on my map and i would like to notify the user when he is within a 1km radius to a point. But i couldn't find a solution or example for this with the Mapbox SDK.

Is there another (easy) way to do this as a beginner?

trytolearn
  • 29
  • 4

1 Answers1

2

https://docs.mapbox.com/help/tutorials/android-location-listening/ shows how you can track a user's location with the Maps SDK for Android.

Every time you get a location update, you can run a calculation to determine whether the device's location is within 1km to the destination Point.

This calculation can be done many ways depending on whether the distance is straight line, how you want to visualize the distance, etc.

There's the within and distance expressions

https://docs.mapbox.com/android/java/examples/turf-circle-poi-within-filter/

https://docs.mapbox.com/android/java/examples/turf-physical-circle/

https://docs.mapbox.com/android/java/examples/turf-line-distance/

A simple Directions API call https://docs.mapbox.com/android/java/examples/show-directions-on-a-map

langsmith
  • 2,529
  • 1
  • 11
  • 13