July 26, 2009

Adding Street View Support to Google Maps

Google Maps API version 2.104 introduces new classes that allow you to integrate Google Street View into your Google Maps. Google Street View provides 360° horizontal and 290° vertical panoramic views for various streets around the world.

The following demos show how you can use the Google Maps API to integrate a Street View Panorama alongside a Google Map.

Google Maps API v2 Example

This demo uses the GStreetviewClient and GStreetviewPanorama classes. To test, click a street on the Google Map. If the script is able to find a panorama nearby, it will be displayed in the Street View pane. The tool tip in the Google Map pane shows the current panorama title and other panoramas nearby.

Google Maps API v3 Example

In Google Maps API version 3, the Street View "viewer" is embedded within the map which can be activated by dragging the pegman onto the map. However, it is possible to instantiate the Street View in a separate pane and bind it with a Google Map as shown in the following demo: