This is a snippet from the series described in Playing around with maps and streetview, and shows the calculation to convert between fov and zoom ObjectiveThe Streetmap image API uses field of view to figure out what part of a panorama to show, whereas streetview in Maps uses zoom levels. This is further complicated because
However, I find these formulae give a slight better (not quite perfect, but closer) representation var fov = Math.atan(Math.pow(2,1-zoom))*360/Math.PI; and var zoom = 1-Math.log(Math.tan(fov*Math.PI/360))/Math.log(2); which give these results for zooms 0-4
The resultUsing this formula, to calculate the fov from the zoom generates a pretty accurate set of parameters to pass over to the streetview image api as you can see from the examples below using various zoom levels with each of the APIs. A generated Streetview image API looks like this For more like this, see Ephemeral Exchange Why not join our forum, follow the blog or follow me on twitter to ensure you get updates when they are available. |
Services > Desktop Liberation - the definitive resource for Google Apps Script and Microsoft Office automation > Ephemeral Exchange > Playing around with maps and streetview >