Question

Currently I manage to get the direction degrees using below code:

d = Math.Atan2(Math.Sin(long2 - long1) * Math.Cos(lat2), _
    Math.Cos(lat1) * Math.Sin(lat2) - Math.Sin(lat1) * Math.Cos(lat2) * Math.Cos(long2 - long1))

Dim direction As Double = (RadToDeg(d) + 360.0) Mod 360

which, in my case let say I got 250.65°

I assign each of the direction values from 0 to 360 to its particular image from imageList which loaded in the pictureBox. (currently I have 36 compass images with different arrow direction, each represent 10 degrees)

When my device is pointed to the north, the arrow image is showing the correct direction, but when when I rotate the device (pointed to anywhere which is not north), the arrow image doesn't change, means it is not showing the correct direction anymore.

So my question is, is it possible to know in which direction the gps device is pointed?

Edit: I'm using Honeywell Dolphin 6000 Scanphone device

Was it helpful?

Solution

The Honeywell Dolphin 6000 documentation doesn't mention a magnetometer or compass, so you're probably SOL. But, if it does have one, then you should be able to find methods to access it in the SDK

I recommend downloading and reviewing any APIs and documents that come with the SDK and look for references to the magnetometer or compass. Microsoft does not have standard APIs to access those sensors in Windows Mobile, so you will need the SDK from Honeywell to get that information.

OTHER TIPS

If I am reading your question correct, it sounds like you are trying to determine a heading when your position is fixed and you are only rotating the device.

Unfortunately, what you are looking for is not possible with GPS.

Both the formula you are using and the GetPosition.Heading is a calculated heading based on sampling your current Latitude/Longitude and your previous Latitude/Longitude. So if you aren't moving in a direction (or moving extremely slowly), your current & previous Latitude/Longitude values will effectively be the same, which reduces that accuracy of the calculated heading.

The only reliable way to get a heading when your position is relatively fixed is to get a magnetic or gyroscopic compass, which some devices to have built in.

"how to know gps device point at which direction?"

by using GPS Intermediate Driver, GetPosition.Heading will give you the current direction you are heading.

As stated in the GPS_POSITION documentation,

"flHeading
"Heading, in degrees. A heading of zero is true north."

You must distinguish between the direction you are moving, that is called bearing or course. And the direction you are looking or holding your device. (Think of you sitting in a bus that drives north (course = 0°), where you make a photo in direction west. heading = 270°)

A (consumer-) GPS receiver always returns only the course (or bearing), although some API unfortunatley call it heading sometimes.

To know the direction in wich you are holding your device while standing still, you have to use the magnetometer. Some modern smartphones, like iPhones or androids have that build into.

Additonal hint:
If your device has GPS, do NOT calculate the position via your or other formulas, better take the value from the GPS Api. This is much more acurate. The GPS chip does NOT only caluclate the direction by positional change, it also may use physical doppler shift.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top