[GIS] OpenLayers With StreetView Overlay

google mapsopenlayers-2

Im trying to add StreetView functionality to my OpenLayers web app, and would like to add the overlay showing StreetView availability to the map itself. I have seen an example of it being done successfully here, but i cannot get the code to work in my own solution. Specifically :

var layer = new OpenLayers.Layer.Google("Google Street", {sphericalMercator: true});

layer.mapObject.addOverlay(new GStreetviewOverlay());

results in the error:

layer.mapObject is null

Has anyone got any idea what i might be doing wrong, and if so, how can I fix this?

Best Answer

Openlayers with Streetview

requires the GeoExt ux extension

all the code is available - so you can see what you are missing

(if you could post a live link to your current map - users could debug it for you.)

enter image description here

http://api.geo.admin.ch/main/wsgi/doc/build/api/streetview.html