I was wondering if it is possible to work out a POV heading for street view based on a GPS coordinate?

For instance, say I have the coordinate '43.6653055692 -79.3102166453'

If I plugin the coordinates into the maps API to create interactive street view:

var myLatlng = new google.maps.LatLng(43.6653055692, -79.3102166453);
var panoramaOptions = {
    position: myLatlng,

var panorama = new google.maps.StreetViewPanorama(document.getElementById('street-canvas'), panoramaOptions);

If finds the closet street view coordinate to the coordinate that I gave, but it doesn't direct the 'camera' towards the coordinate, like the static image API does. I want it to be pointing to the GPS coordinate. This seems to work when doing it for static images, but not for the interactive maps. Is there an option I'm missing?

Static Image URL: https://maps.googleapis.com/maps/api/streetview?location=43.6653055692,-79.3102166453&size=600x400

  • You need to add Point of View (POV) and Heading to point the streetview panorama in the correct direction. google-developers.appspot.com/maps/documentation/javascript/…
    – Mapperz
    Feb 10, 2015 at 20:15
  • here is your coordinates and POV=1.5 Heading=65 jsfiddle.net/9tnqy0md (edit & click to run to adjust)
    – Mapperz
    Feb 10, 2015 at 20:21
  • 1
    @mapperz - Sorry, I should have said, but I know about the POV param, but I was wondering if there was a way to automatically work out what the POV value is suppose to be by relating the street view position to the GPS location.
    – SynackSA
    Feb 11, 2015 at 1:23

2 Answers 2


I think you can use the google.maps.geometry.spherical.computeHeading method.

See documentation here: https://developers.google.com/maps/documentation/javascript/geometry#Navigation


The Streetview Images API returns the image from the closest spot to your request. What OP needs is a view from the nearest major street.

The full StreetView API :: StreetViewPanorama class has BEST / CLOSEST params where Google filters for this "front door" intent, rather than just using the nearest image. It would be very nice to access this from the static image API.

In commercial areas it seems like many corner lots are shot from a bad angle, since the side street is closer.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.