Google Street View Image API Tutorial

Google Provides Street View Image API to download street view images with a simple http request.
The API has daily limit of 25,000 image requests.Street View images can be downloaded in any size up to 640×640 pixels.

Working Street View Image website : http://www.streetview.cc

How to send Google Street View Image API request

To access Image API you need to get Google Browser Apps API Key. Below is the http request you need to send to get stree view image.

http://maps.googleapis.com/maps/api/streetview?
                                         size=IMAGE_SIZE
 					 &location=LOCATION_LAT_LONG
	 	                         &sensor=SENSOR_STATUS
					 &key=GOOGLE_API_CONSOLE_KEY
					 &heading=HEADING
					 &fov=FOV
					 &pitch=PITCH

 

IMAGE_SIZE = size of the image. Format: width x height
LOCATION_LAT_LONG = Location of the street. Format: lattitude, longitude
SENSOR_STATUS= GPS enabled or not. Format: true/false
HEADING= Compass heading of the Camera. Format: 0 to 360
FOV= Horizontal filed of view of the image. Format: 0 to 120 (default: 90)
PITCH= Up or down angle of the camera relative to the Street View vehicle. Format: -90 to 90
GOOGLE_API_CONSOLE_KEY = Google Browser API Key. Get your own key from API Console

Sample URL Request:  Click Here

How to get the current StreetView parameters

street view parameters are read using the JavaScript object google.maps.StreetViewPanorama

panorama = new  google.maps.StreetViewPanorama(document.getElementById('pano'),panoramaOptions);

lat =panorama.getPosition().lat();
lng =panorama.getPosition().lng();
heading= panorama.getPov().heading;
pitch=panorama.getPov().pitch;
zoom=panorama.getPov().zoom;

FOV is calucalated using the below forumla.
fov = 90/Math.max(1,zoom);

About Author

I am a developer and I maintain the site https://hayageek.com. The best software developers are those who can think like both a developer and a user.
All posts by Ravishanker Kusuma