Visualizzazione dei risultati da 1 a 2 su 2
  1. #1

    Pausa in una funzione per Google Maps

    Salve a tutti, ho inserito una mappa di Google nel mio sito internet, che permette di segnare degli indirizzi a partire da un file XML...

    Il tutto funziona, a parte un errore 620 che sembra sia dato da interrogazioni troppo veloci al geocoder di Google.

    Vorrei quindi inserire una pausa di tot secondi nella funzione qui sotto, in modo da aggirare questo errore.

    Ho visto come usare window.setTimeout, ma (probabilmente perché con Javascript sono una pippa) non riesco a farlo funzionare a dovere...

    Mi sapete aiutare?

    Ecco il codice


    codice:
    function showAddress(location) {
     	
    
      if (map && geocoder) {
      
    
    	
      geocoder.getLocations(
        location.address,
        function(result) {
            // If that was successful
            if (result.Status.code != G_GEO_SUCCESS) {
              // ====== Decode the error status ======
              var reason="Code "+result.Status.code;
              if (reasons[result.Status.code]) {
                 reason = reasons[result.Status.code]
              } 
              // alert('Could not find "'+search+ '" ' + reason);
    	  GLog.write(location.address + " non trovato, cod="+result.Status.code+" "+reason);
    
    	} else { // get first result (the one that getLatLng uses)
              var p = result.Placemark[0].Point.coordinates;
              var point = new GLatLng(p[1],p[0]);
    
    	  map.setCenter(point, 11);
    	  var marker = createMarker(point, "" + location.html + "" + "
    " + location.address);
    	  map.addOverlay(marker);
    	  marker.openInfoWindowHtml("" + location.html + "" + "
    " + location.address);
              //GLog.write("{address:'"+location.address+"', lat:"+point.lat().toFixed(6)+", lng:"+point.lng().toFixed(6)+", html:'"+location.html+"'},");
    	}
      }
      )
    
      } else { GLog.write("map or geocoder does not exist!"); }
    }

  2. #2
    Nessuno?

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.