I'm using the v3 maps JS API google.maps.getPanoramaByLocation to create a link to streetview with lat/lng which looks like: http://maps.google.com/?cbll=52.099659,0.140299&cbp=12,0,,,&layer=c, but I was wondering if anyone knew how to get rid of the large left-hand sidebar that appears in street view by default? I've checked mapki but no dice.
A:
Consider the following example. It uses the getPanoramaByLocation()
method, and does not render a left sidebar:
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<title>Google Maps API v3 - Street View Demo</title>
<script src="http://maps.google.com/maps/api/js?sensor=false"
type="text/javascript"></script>
</head>
<body>
<div id="pano" style="width: 400px; height: 300px;"></div>
<script type="text/javascript">
var panorama = new google.maps.StreetViewPanorama(
document.getElementById('pano')
);
var sv = new google.maps.StreetViewService();
sv.getPanoramaByLocation(
new google.maps.LatLng(42.345573,-71.098326),
50,
function (data, status) {
if (status == google.maps.StreetViewStatus.OK) {
panorama.setPano(data.location.pano);
panorama.setPov({ heading: 270, pitch: 0, zoom: 1 });
panorama.setVisible(true);
}
}
);
</script>
</body>
</html>
Screenshot:
Daniel Vassallo
2010-09-01 23:41:52
I was after creating a link, not creating a panorama myself.We may go with this and create a popup dialog on our site, but originally we'd planned to just have a link to the position on Street View.
Ian Grainger
2010-09-02 09:32:52
@Ian: This is a list of known Google Maps parameters: http://mapki.com/wiki/Google_Map_Parameters. However there doesn't seem to be the option to remove the side bar. Maybe the `output=embed` is close, but that is not supposed to work for links.
Daniel Vassallo
2010-09-02 11:30:14
@Daniel - yeah, I included the link to mapki in my question. I'd looked there but not found anything. Hence asking here.
Ian Grainger
2010-09-03 08:48:57