|
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Google Maps StreetView Example</title>
<script src="http://maps.google.com/maps?file=api&v=2&key=abcdefg&sensor=true_or_false"
type="text/javascript"></script>
<script type="text/javascript">
var marker = null;
var myPano = null;
function openWindow()
{
myPano = new GStreetviewPanorama(document.getElementById("stview"));
var latlang = marker.getLatLng();
myPano.setLocationAndPOV(latlang);
}
function initialize() {
if (GBrowserIsCompatible()) {
myPano = new GStreetviewPanorama(document.getElementById("stview"));
map = new GMap2(document.getElementById("map_canvas"));
map.setCenter(new GLatLng(37.4419, -122.1419), 13);
map.setUIToDefault();
var streetOverlay = new GStreetviewOverlay();
var latlang = map.getCenter();
var icon = new GIcon();
var imageUrl = "http://maps.gstatic.com/mapfiles/cb/man_arrow-0.png";
icon.image = imageUrl;
icon.iconSize = new GSize(49,52);
icon.iconAnchor = new GPoint(25,36);
icon.infoWindowAnchor = new GPoint(25,6);
marker = new GMarker(latlang, {"icon":icon, "draggable":true});
GEvent.addListener(marker, "dragstart", function()
{
map.addOverlay(streetOverlay);
}
);
GEvent.addListener(marker, "dragend", function(overlay,latlang)
{
map.removeOverlay(streetOverlay);
openWindow();
}
);
map.addOverlay(marker);
}
}
</script>
</head>
<body onload="initialize()" onunload="GUnload()">
<div id="map_canvas" style="width: 500px; height: 300px"></div>
<div id="stview" style="width: 500px; height: 200px"></div>
</body>
</html>
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
I came to the the software industry in 2006 now i am familiar with C#, ASP.NET, SQL Server, JavaScript,Google Maps and Virtual Earth API and looking forward for a long way ahead.