I'm trying to use BearingTo from GNSS, but it returns negative results for locations West of my current location. These results also include locations such as Northwest and Southwest of my location. I'm probably not using BearingTo correctly. In that case, I was expecting it to return a number somewhere between 0 and 359. For locations East of my current location, I get accurate results. Can you let me know what I still need to do to get the correct results for the westerly locations?
Here's the coordinates for several locations I used to test BearingTo:
B4X:
BearingTarget.Initialize2("42.537289", "-71.512802") ' Littleton, MA from Westford, MA
BearingTarget.Initialize2("42.599814", "-71.367284") ' Chelmsford, MA from Westford, MA
BearingTarget.Initialize2("42.765366", "-71.467566") ' Nashua, NH from Westford, MA
BearingTarget.Initialize2("42.764811", "-71.439788") ' Hudson, NH from Westford, MA
Littleton is Soutwest of me.
Chelmsford is Eastnortheast of me.
Nashua is Northnorthwest of me.
Hudson is Northnortheast of me.
Here are the numbers returned by using this statement:
If I use Littleton as an example, I was expecting BearingTo to return a number somewhere between 220 and 250. As a quick fix you can tell me what number to add to the returned negative number to use an accurate bearing to?
I included a map so you can see the relation of the locations compared to Westford.
Conventionally longitudes West of the meridian are -ve values 0 to 180, East is +ve values 0 to 180. I guess this is reflected into the bearing values.
Conventionally longitudes West of the meridian are -ve values 0 to 180, East is +ve values 0 to 180. I guess this is reflected into the bearing values.