Search code examples
google-mapsgoogle-street-view

Getting the POV for Google StreetView API


I am currently using the Google Street View Panorama embed and I want to get the POV (more specifically heading) for a particular address.

Google does this via maps.google.com, where, given an address, it'll drop you into street view and it will face the right way. However, I can't seem to figure out / find documentation for a way to find the POV heading via the API.

I can get the Street View embed to work fine with a LatLng, but the camera is usually facing the wrong direction. Any ideas?

edit: clarity

I want to set the POV, but I don't know what value to set it to...


Solution

  • The latLng of the required address and the latLng of the panorama location (the position of the streetview car from where images are shot) are not the same. As far as I know, the API does not set the heading in the right direction of the address latlng, you will have to set it yourself.

    This is how I did it, I used the StreetViewService to find the nearest panorama shot available and then calculated the Pov heading using the computeHeading method here