google streetview
-
Heya, I'm trying to combine google streetview with input I get from other scripts. For example, I get a street name from a other script, but want an streetview window to automaticly load that street. I've been reading through the google documentation, and tried some examples found on the internet, but my decent lack of js skills are lacking me from getting much further. Google Maps StreetView[^] is an example, but this one works with an dragger, while I try to make it load automaticly on other input. Any one who can sling me into the right direction? :)
-
Heya, I'm trying to combine google streetview with input I get from other scripts. For example, I get a street name from a other script, but want an streetview window to automaticly load that street. I've been reading through the google documentation, and tried some examples found on the internet, but my decent lack of js skills are lacking me from getting much further. Google Maps StreetView[^] is an example, but this one works with an dragger, while I try to make it load automaticly on other input. Any one who can sling me into the right direction? :)
These are the jscript functions you need ... This function takes an address as a string
function showAddress(thisaddress)
{
var geocoder = new GClientGeocoder();
geocoder.setBaseCountryCode("uk");
geocoder.getLatLng(thisaddress, gotPoint);
searchaddress=thisaddress
}The next function is called by the one above in order to show the address or marker on a map Note that I've commented out the code that places a marker at the point
function gotPoint(pt)
{
if (!pt)
{alert(searchaddress + " not found");}
else
{
// map.setCenter(point, 13);
// var marker = new GMarker(point);
// map.addOverlay(marker);
// marker.openInfoWindowHtml(thisaddress);
document.formInput.txtPoint.value = pt;
panoClient.getNearestPanoramaLatLng(pt, fnearestpano);
}
}Finally, the function finds the nearest StreetView image to the address
function fnearestpano(latlng)
{
if (!latlng)
{ alert("nearest view not found"); }
else
{
//alert("point=" + latlng);
myPano = new GStreetviewPanorama(document.getElementById("pano"));
myPano.setLocationAndPOV(latlng, myPOV);
}
}Hope that helps? Richard