I am working on a project that takes the compass script from Phonegap and i would like to connect it to my currect GPS position and than point to a fixed GPS position (like a restaurant etc.) Basicly the arrow must be pointing in the direction of the restaurant so i know which way to go/walk.
These are the two i would like to combine: http://docs.phonegap.com/en/2.0.0/cordova_geolocation_geolocation.md.html#Geolocation http://docs.phonegap.com/en/2.0.0/cordova_compass_compass.md.html#Compass
I have this projec as the base: https://github.com/Rockncoder/PGCompass
Who can help me in the right direction :-) ?
Thnx Ewald
The following code basically does what you want. It calculates the distance and bearing from your current location (by GPS) to a destination position and uses the compass to determine your current heading. The difference between your current heading and the bearing to the destination is the angle for your arrow.
The code with assets and compiled Android APK can be downloaded from here: http://ge.tt/4Kb2oQv/v/0
Here's the code, hope it helps!