Hi.
Thanks for you rapid response.
This question is more related to how the trigger of this part is
executed automatically:
/* ISSUE IS HERE */
GEvent.addListener(map, function(overlay, latlng) {
myPano.setLocationAndPOV(latlng);
});
}
}
When I click on the map all works fine. If there is no easy solution
to this problem, is there an easy way I can remove the Listener so it
displays the map only again ?
I have the StreetView layer over my MAP layer which works fine. You
clikc on the map and the streetview layer is displayed. Now if I can't
have the GEvent execute by itself without click, is there any way for
me to remove the "Listener" so it resets?
Thanks,
Markus
On Apr 20, 8:37 am, mapperzUK <[email protected]> wrote:
> tryhttp://mapperz.googlepages.com/nz_street_view.html
>
> (just clicking the on the map activates the streetview).
>
> change the lat/lng for the your UK Postcode here and as long as it is
> with the streetview coverage it will work.
> map.setCenter(new GLatLng(-41.286449, 174.7784), 14);
>
> for more advance streetview (including driving
> directions)http://mapperz.blogspot.com/2009/03/google-street-view-uk-launched.html
>
> Mapperzhttp://mapperz.blogspot.com/http://twitter.com/mapperz
>
> On Apr 20, 12:20 am, "[email protected]" <[email protected]>
> wrote:
>
> > 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
-~----------~----~----~----~------~----~------~--~---