I've got a mapping application that does a spatial search and finds
nearest services (things like libraries etc) and I want to have a link
that the user can click so they can then see that building/service in
Street View. I've got Google Street View to launch at the location of
the building but I'm wondering if it's possible for Street View to
start by looking in the direction of that building? So, I've tried to:

- take building coordinates from the search results of my mapping
application and convert the coordinates from British National Grid
projection to WGS-84
- start Google Maps Street View, setting the LatLng to be the LatLng
of the building returned by the spatial search (initial bearing set to
be 145 degrees).
- For the panorama that is initially found near to the LatLng of the
building, retrieve the LatLng of the Street View panorama
- then calculate the bearing between the Street View panorama LatLng
and the building LatLng.
- then re-start Street View, setting the LatLng to be the LatLng of
the Street View panorama and the bearing to be the bearing calculated

I've found a problem with this approach. The first time I did it I
tried to calculate the bearing using the latitude and longitude values
but the calculation wasn't successful. I'm not 100% sure why it wasn't
successful but it might be a precision issue - the latitude value of
the Street View panorama is identical to the building latitude and the
panorama longitude is only slightly different to the building
longitude, in all cases the calulation either works out the bearing to
be 90 degrees or -90 degrees. So then I tried converting the values of
the Street View panorama to be British National Grid and then
calculate the bearing between the Street View panorama and the
building in British National Grid projection. However with this
approach the problem is still that the LatLng of the panorama seems to
be almost identical to the LatLng of the building. So when I convert
the Street View panorama to British National Grid projection and the
Street View panorama is always about 0.96m north of the building and
about 0.6m east of the building, meaning the bearing always works out
to about 238 degrees.

So the problem seems to be that the LatLng of the Street View panorama
is always nearly identical to the LatLng of the building I want to
look at and that any bearing calculation doesn't reflect what the
bearing would be on the ground. I've come to a dead-end but am
thinking that maybe other people have attempted to do something
similar? If so, were you able to calculate which direction Street View
should face when looking at certain things?

Thanks very much,
Mike.

-- 
You received this message because you are subscribed to the Google Groups 
"Google Maps JavaScript API v3" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-maps-js-api-v3?hl=en.

Reply via email to