Forum Moderators: open
<script src="http://maps.google.com/maps?file=api&v=2&key=MY API KEY"
type="text/javascript"></script>
<script type="text/javascript">//<![CDATA[
var geocoder;
var map;var address = "<%=rs("address") %>, New York, NY";
// On page load, call this function
function load()
{
// Create new map object
map = new GMap2(document.getElementById("map"));// Create new geocoding object
geocoder = new GClientGeocoder();// Retrieve location information, pass it to addToMap()
geocoder.getLocations(address, addToMap);}
// This function adds the point to the map
function addToMap(response)
{
// Retrieve the object
place = response.Placemark[0];// Retrieve the latitude and longitude
point = new GLatLng(place.Point.coordinates,
place.Point.coordinates[0]);// Center the map on this point
map.setCenter(point, 13);
map.addControl(new GSmallMapControl());// Create a marker
marker = new GMarker(point);// Add the marker to map
map.addOverlay(marker);// Add address information to marker
marker.openInfoWindowHtml(address + '<br\>Rent : $<%= Currency_Format_Function(rs("rent")) %>');}
//]]>
</script>
</head>
<body onload="load()" onunload="GUnload()">
<div id="map" style="width: 400px; height: 300px"></div>
SO i basiclly want the above functionality working with the street view API below, any ideas?
<script src="http://maps.google.com/maps?file=api&v=2.x&key=MY API KEY"
type="text/javascript"></script>
<script type="text/javascript">var myPano;
function initialize() {
var fenwayPark = new GLatLng(42.345573,-71.098326);
panoramaOptions = { latlng:fenwayPark };
myPano = new GStreetviewPanorama(document.getElementById("pano"), panoramaOptions);
GEvent.addListener(myPano, "error", handleNoFlash);
}function handleNoFlash(errorCode) {
if (errorCode == FLASH_UNAVAILABLE) {
alert("Error: Flash doesn't appear to be supported by your browser");
return;
}
}
</script>
</head><body onload="initialize()" onunload="GUnload()">
<div name="pano" id="pano" style="width: 500px; height: 300px"></div>
[1][edited by: tedster at 3:44 pm (utc) on Aug. 30, 2008]
[edit reason] remove actual API key [/edit]
var fenwayPark = new GLatLng(42.345573,-71.098326);
panoramaOptions = { latlng:fenwayPark };
var myPano = new GStreetviewPanorama(document.getElementById("pano"), panoramaOptions);
this is the simplest case with the default POV north.
there are more detailed examples in the linked documentation - error handling, setting the POV, etc...