GPS to determine direction

Hello everyone,
A difficult question: my devices are missing a compass. Can I use GPS to determine direction? So similar to a compass.
Thanks in advance for the tips.

Perhaps this ?

(You will need to set the imageSprite originX and originY to 0.5)

Yes, by calculating a bearing from two different coordinates

Simpler if your device has an Orientation sensor

or very simply
make a on screen compass like a real compass using a compass rose image. It will always point and determine the direction of travel

1 Like

Or, if you want your app to display „N“ or „SW“, you can use these blocks

Thanks and hello everyone,
The proposed ideas cannot work: as I said, there is no orientation sensor!
Best regards

Then do as @SteveJG suggested, and use two sets of coordinates to calculate a bearing.

The math involving calculating a bearing from two points:

https://www.movable-type.co.uk/scripts/latlong.html

Some Blocks:

Another way without an Orientation sensor (not sure the Map compass works without a OS but using the second link and its blocks certainly will I believe)

Do any of these options work for you Andy? :thinking:

Hello and first of all thank you very much,
I implemented it as in the example, but only ever gets 180 displayed. What am I doing wrong?
Best regards
kompass.aia (60.5 KB)

I only ever need one arrow that stays pointing north.

I don't think you can point the North pole using this formula (the one from MovableType). The formula becomes unstable when one of the sets of coordinates approaches the neighborhood of the pole. You seem be trying to point at the North pole. :cry:

You are not going to build a compass doing that. The code was developed to be able to use for navigation way points. It does that quite well.

I didn't thoroughly check your Math blocks for math errors and logic errors.

I am very busy today. If I can, I will post something that shows how the algorithm works late today or sometime tomorrow. In the meanwhile, someone else might post. You could use the advice @TIMAI2 posted using a destination north of you (high latitude, your locationsensor determined longitude). (but it also uses the Orientation component)

I build a compass like this:

using the Orientation sensor.

What devices are you using (the one without Orientation sensor capability)?

Thanks this is needed for the route guidance of some self-propelled mobiles. The equipment is pretty rudimentary.
Greetings