Calculate heading to the marker in street view

749 views
Skip to first unread message

GSerg

unread,
May 14, 2011, 2:11:12 PM5/14/11
to google-map...@googlegroups.com
I've got a marker on a map (v.3).
I then bring up the default panorama (.getStreetView()), using marker.getPosition() for panorama.setPosition().
 
I then have to manually rotate the street view to find my marker. This is the step I want to avoid.
But I can't seem to be able to calculate the heading value for setPov().
 
I've tried computeAngle() function from this example, but it doesn't seem to help, as in the example the coordinates of the panorama POV and the marker are indeed different, but in my case, they are "same," so the function always returns 0.
 
I'm putting quotes arond "same" because on the actual display they are not. A panorama POV is always in the middle of the road, whereas a marker, even created with the same LatLng, is always on the side of the road, against an actual building. So the marker is visible at certain heading, and not visible otherwise.
 
How can I calculate that heading?

The Real Estate

unread,
May 18, 2011, 12:46:10 PM5/18/11
to Google Maps JavaScript API v3
Hello,

Did you figure this out? I'm trying to do the same thing...center the
streetview on the marker, not on the street.

Thank you for any input.

On May 14, 2:11 pm, GSerg <gser...@gmail.com> wrote:
> I've got a marker on a map (v.3).
> I then bring up the default panorama (.getStreetView()), using
> marker.getPosition() for panorama.setPosition().
>
> I then have to manually rotate the street view to find my marker. This is
> the step I want to avoid.
> But I can't seem to be able to calculate the heading value for setPov().
>
> I've tried computeAngle() function from this example<http://gmaps-samples.googlecode.com/svn/trunk/streetview/angletowards...>,

Chris Broadfoot

unread,
May 19, 2011, 2:15:35 AM5/19/11
to google-map...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages