I am building an app that uses an image from the Google Street View API. I am needing to zoom in to the image.
I am using the event pov_changed
, I track changes to the POV pitch and heading. To decide the zoom in the final image I need a FoV (Field of View) attribute.
https://maps.googleapis.com/maps/api/streetview?size=700x600&location=40.159172842909,-103.201315097248&heading=22.3118227257402&pitch=-1.42049583899625&key=<key>&fov=20
I have a setup like this...
center = new google.maps.LatLng(address.latitude, address.longitude)
map = new google.maps.Map(document.getElementById('map'), {
center: center,
zoom: address.zoom
})
street = new google.maps.StreetViewPanorama(document.getElementById('street'), {
position: center,
pov: {
heading: address.pov_heading || 150,
pitch: address.pov_pitch || 0.75
}
})
To get get the values to update a form I have some thing like... but I can't find how to get the Field of View attribute.
street.addListener 'pov_changed', ->
pitchField.html(street.getPov().pitch)
headingField.html(street.getPov().heading)
# console.log(street.getFov()) # is not a function
# console.log(street.getFoV()) # is not a function
# console.log(street.getFOV()) # is not a function
How can I find the Field of View to use in a link as above to zoom in to the image.
You can't get FOV, it's not in the API https://developers.google.com/maps/documentation/javascript/3.exp/reference
As anatoly.sukhanov posted, you can find the way to calculate it in this question already asked on SO how can I determine the Field of View a street view panorama map is using