Hi All, I had a developer helping me and he is now gone and does not want to assist anymore. I think he is not capable and turn to you to see if you can help me.
I know basic Javascript and have made changes to this code myself and it is working fine. What I'm trying to do is to add on the StreetView element and if possible have a button switching between viewing normal Google Maps and the StreetView where possible. If that is not possible or to complicated I would love just to have the current code displaying the map as it does now but without having to click on the map... #### CODE START #### var map; var point; var localSearch = new GlocalSearch(); var post='<%=post %>'; var icon = new GIcon(); icon.image = "http://www.movingspace.com/images/marker.png"; icon.shadow = "http://www.google.com/mapfiles/shadow50.png"; icon.iconSize = new GSize(20, 34); icon.shadowSize = new GSize(37, 34); icon.iconAnchor = new GPoint(10, 34); function usePointFromPostcode(postcode, callbackFunction) { localSearch.setSearchCompleteCallback(null, function() { if (localSearch.results[0]) { var resultLat = localSearch.results[0].lat; var resultLng = localSearch.results[0].lng; point = new GLatLng(resultLat,resultLng); callbackFunction(point); var marker = new GMarker(point,icon); map.addOverlay(marker); // }else{ alert("Postcode not found!"); } }); localSearch.execute(postcode + ", UK"); } function setCenterToPoint(point) { map.setCenter(point, 16); } function initialize() { if (GBrowserIsCompatible()) { var myPano = new GStreetviewPanorama(document.getElementById ("pano")); GEvent.addListener(myPano, "error", handleNoFlash); map = new GMap2(document.getElementById("map1")); usePointFromPostcode(post, setCenterToPoint); map.setCenter(new GLatLng(point), 14); /* ALL WORKS FINE AND AS EXPECTED UP TO HERE. THE MAP DISPLAYS THE CORRECT AREA BY THE TRANSFORMED POSTCODE AND ALL IS GOOD */ svOverlay = new GStreetviewOverlay(); map.addOverlay(svOverlay); /* ISSUE IS HERE */ GEvent.addListener(map, function(overlay, latlng) { myPano.setLocationAndPOV(latlng); }); } } /* STILL THE CODE IS WORKING FINE AND WHEN YOU CLICK ON ANY ROAD THAT HAS THE OVERLAY AND STREET VIEW CAPABILITY IS DISPLAYS IT IN A DIV UNDERNEATH. */ function handleNoFlash(errorCode) { if (errorCode == FLASH_UNAVAILABLE) { alert("Error: Flash doesn't appear to be supported by your browser"); return; } } function addLoadEvent(func) { var oldonload = window.onload; if (typeof window.onload != 'function') { window.onload = func; } else { window.onload = function() { oldonload(); func(); } } } function addUnLoadEvent(func) { var oldonunload = window.onunload; if (typeof window.onunload != 'function') { window.onunload = func; } else { window.onunload = function() { oldonunload(); func(); } } } addLoadEvent(initialize); addUnloadEvent(GUnload); #### CODE END #### What I'm trying to do is to either have a button for Streetview and one for Map View ... or to have the Streetview triggering when the page loads and I can perhaps hide it in a DIV and then display it ... Either way or any other way anyone can recommend is very welcome. I'm completely stuck spent almost two days on this now and my energy level and patience is being drained... Greateful for any help! Regards, Markus --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google Maps API" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/Google-Maps-API?hl=en -~----------~----~----~----~------~----~------~--~---
