amay077 / Xamarin.Forms.GoogleMaps

Map library for Xamarin.Forms using Google maps API
https://www.nuget.org/packages/Xamarin.Forms.GoogleMaps/
MIT License
546 stars 346 forks source link

Get direction user is facing #636

Closed shaunwurdeman closed 5 years ago

shaunwurdeman commented 5 years ago

SUMMARY

Is there any way to get the current direction (bearing) the user is pointing the phone from the map directly?

At the moment I am using Xamarin.Essentials.Compass, but it returns the magnetic bearing which does not line up with the little arrow on the blue position dot, presumably due to magnetic declination.

DETAILS

In my use case the user should be able to point their phone in a direction and place a line on the map starting at their current position (not a problem) and extending out one kilometre in the direction they have indicated. Using the bearing from Xamarin.Essentials.Compass causes this line to go significantly left (should be different depending on where you are in the world) of the direction the little blue arrow on the blue position dot indicates the phone is facing.

Is there a way that we could access the bearing that the map uses for it's direction arrow directly? Rather than having to get the bearing through another system and then manually compensating for magnetic declination?

(Also, would just like to take this opportunity to thank you, and all the contributors, for this project. It works fantastically)

PLATFORMS

amay077 commented 5 years ago

Thanks @shaunwurdeman , Xamarin.Forms.GoogleMaps does not support getting direction. If you not enough to Xamarin.Essentials.Compass, you could use Android/iOS Native compass like APIs but I think same as Xamarin.Essentials.Compass :sweat: .

shaunwurdeman commented 5 years ago

Ah thanks, I have got my implementation working with a manual calibration process for the user to get an accurate magnetic declination for their current location, so fortunately it's not a showstopper for me. Was just hoping to get around it since the underlying Google Map looks like it does have the accurate direction information.