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...
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.
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.
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).
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With