Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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...

like image 442
Benny Wong Avatar asked Aug 15 '11 17:08

Benny Wong


People also ask

How do I get a Google Street View API key?

Go to the Google Maps Platform > Credentials page. On the Credentials page, click Create credentials > API key. The API key created dialog displays your newly created API key. Click Close.

Is Street View available in Google Maps free API?

The Maps JavaScript API provides a Street View service for obtaining and manipulating the imagery used in Google Maps Street View. This Street View service is supported natively within the browser.

How do you get POV on Google Maps?

Click and hold the person icon in the bottom-right corner of the screen and drag it to the spot you want to view (as you move the cursor over the map, the streets will highlight in blue — make sure that you place the icon onto one of those, otherwise you won't be able to see the street view).


1 Answers

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

like image 163
manubkk Avatar answered Sep 20 '22 11:09

manubkk