Search code examples
androidmapboxmapbox-android

Check if in front of user/bearing in mapbox - andorid


I just want to know if there is a way to notify the user if there is a marker in like.. 100 meters in front of them, and I mean in front the bearing/degree of the user.

just like:

enter image description here

Or if there is a way to attach a triangle polygon's top point to the bearing/degree of the user?

PS: I'm creating an app to reduce traffic.


Solution

  • You could use the Mapbox Java SDK port of http://turfjs.org/docs/#bearing

    https://github.com/mapbox/mapbox-java/blob/master/docs/turf-port.md#measurement

    https://github.com/mapbox/mapbox-java/blob/master/services-turf/src/main/java/com/mapbox/turf/TurfMeasurement.java#L56

    https://github.com/mapbox/mapbox-java/search?q=TurfMeasurement.bearing&unscoped_q=TurfMeasurement.bearing