I'm building a virtual tour application that uses Google's streetview code to render the panoramas into a non-distorted view. Each panorama has 1 to n links where the user can select to move on.

I use the GPS coordinates of each location to calculate the compass bearing from the current location to the next. The issue has to do with StreetView's rendering of the link bearings.

When a panorama loads, one of the data fields required is centerHeading. This determines the part of the image that is rendered smack dab in the middle of whatever element you're using as a map container.

In addition, whatever value centerHeading has is what StreetView sees as due north. The link rendering locations are displayed relative to north, which causes quite a bit of inaccuracy with the link bearings.

Check out this for an example. The bearing from the start location to the next is 247 degrees, as calculated from the GPS coordinates of each location. Due to the way the image was taken, the centerHeading value is 175 degrees, and this throws off the actual links quite a bit. In order to have a correct link bearing, I have to manually replace the calculated bearing of 247 degrees with 0.

Multiply this trial and error bearing testing by over 100 seemingly arbitrary heading definitions, and you just might get a headache.

So my question is, is there a way to factor in the location's heading setting in the link bearing calculations?