Hi all,
I have an italian site with google maps and get directions.
For all directions that I use I obtain always Error 602.

I searched in this group and I found a post about the same problem,
but for UK.
I tried to change my code but the problem in not resolved.

Please help me because days and days to try and now I don't know what
to do ...

Thank you very much!
Bye


The url is (I'm working in it):
http://dev.newtargetweb.it/arli/mappa.php?addr=Largo%20Porta%20Nuova%2012,%20Bergamo&pv=Arli%20Hotel

My code is:

-------------------------------------------------------------------------------------------------

<script type="text/javascript">

    //<![CDATA[

        var geocoder = null;
        var map =null;
        var gdir;

    function load() {
      if (GBrowserIsCompatible()) {
                map = new GMap2(document.getElementById("map"));
                geocoder = new GClientGeocoder();
        //map.setCenter(new GLatLng(37.4419, -122.1419), 13);
                var mapTypeControl = new GMapTypeControl();
        var topRight = new GControlPosition(G_ANCHOR_TOP_RIGHT, new
GSize(10,10));
        var bottomRight = new GControlPosition(G_ANCHOR_BOTTOM_RIGHT,
new GSize(10,10));
        map.addControl(mapTypeControl, topRight);
        GEvent.addListener(map, "dblclick", function() {
          map.removeControl(mapTypeControl);
          map.addControl(new GMapTypeControl(), bottomRight);
        });
        map.addControl(new GSmallMapControl());

                //icon
                var baseIcon = new GIcon();
                baseIcon.image = "logo.png";
                //baseIcon.shadow = 
"http://www.google.com/mapfiles/shadow50.png";;
                baseIcon.iconSize = new GSize(50, 22);
                //baseIcon.shadowSize = new GSize(37, 34);
                baseIcon.iconAnchor = new GPoint(20, 34);
                baseIcon.infoWindowAnchor = new GPoint(30, 2);
                baseIcon.infoShadowAnchor = new GPoint(50, 25);

                        if (geocoder) {
                                geocoder.getLatLng(
                                "<?php echo $indirizzo; ?>",
                                function(point) {
                                        if (!point) {
                                                alert("<?php echo $indirizzo; 
?>" + " non trovato");
                                        } else {
                                                map.setCenter(point, 13);
                                                var marker = new GMarker(point, 
baseIcon);
                                                map.addOverlay(marker);
                                                
marker.openInfoWindowHtml("<span class='baloon'>Arli Hotel<br /
><?php echo $indirizzo; ?></span>");
                                        }
                                }
                                );
                        }

        }
        else
        {
                        alert("Browser non compatibile con le mappe di Google. 
Contatta il
webmaster per maggiori informazioni.");
                }
                gdir = new GDirections(map, 
document.getElementById("directions"));
        GEvent.addListener(gdir, "load", onGDirectionsLoad);
        GEvent.addListener(gdir, "error", handleErrors);
    }

        function setDirections(fromAddress, toAddress, locale) {
                if (fromAddress.length<3) alert("Inserire l'indirizzo.");
            else gdir.load("from: " + Trim(fromAddress) + " IT to: " +
toAddress, { "locale": locale });
        }

        function handleErrors(){
                if (gdir.getStatus().code == G_GEO_UNKNOWN_ADDRESS)
                     alert("Non è stato trovato l'indirizzo inserito. Questo
potrebbe essere causato da un errore di inserimento oppure dal fatto
che l'indirizzo è relativamente nuovo.\nError code: " + gdir.getStatus
().code);
                   else if (gdir.getStatus().code == G_GEO_SERVER_ERROR)
                     alert("Il servizio di cartografia in questo momento ha 
problemi
tecnici. Vi preghiamo di riprovare più tardi.\n Error code: " +
gdir.getStatus().code);

                   else if (gdir.getStatus().code == G_GEO_MISSING_QUERY)
                     alert("The HTTP q parameter was either missing or had no 
value.
For geocoder requests, this means that an empty address was specified
as input. For directions requests, this means that no query was
specified in the input.\n Error code: " + gdir.getStatus().code);

                //   else if (gdir.getStatus().code == G_UNAVAILABLE_ADDRESS)  
<---
Doc bug... this is either not defined, or Doc is wrong
                //     alert("The geocode for the given address or the route 
for the
given directions query cannot be returned due to legal or contractual
reasons.\n Error code: " + gdir.getStatus().code);

                   else if (gdir.getStatus().code == G_GEO_BAD_KEY)
                     alert("The given key is either invalid or does not match 
the
domain for which it was given. \n Error code: " + gdir.getStatus
().code);

                   else if (gdir.getStatus().code == G_GEO_BAD_REQUEST)
                     alert("A directions request could not be successfully 
parsed.\n
Error code: " + gdir.getStatus().code);

                   else alert("C'è stato un errore sconosciuto.");

                }
        function onGDirectionsLoad(){
          // Use this function to access information about the latest
load()
          // results.

          // e.g.
          // document.getElementById("getStatus").innerHTML = gdir.getStatus
().code;
        }


function URLEncode(plaintext)
{
        // The Javascript escape and unescape functions do not correspond
        // with what browsers actually do...
        var SAFECHARS = "0123456789" +                                  // 
Numeric
        "ABCDEFGHIJKLMNOPQRSTUVWXYZ" +  // Alphabetic
        "abcdefghijklmnopqrstuvwxyz" +
        "-_.!~*'()";                                    // RFC2396 Mark 
characters
        var HEX = "0123456789ABCDEF";

        var encoded = "";
        for (var i = 0; i < plaintext.length; i++ ) {
                var ch = plaintext.charAt(i);
            if (ch == " ") {
                    encoded += "+";                             // 
x-www-urlencoded, rather than %20
                } else if (SAFECHARS.indexOf(ch) != -1) {
                    encoded += ch;
                } else {
                    var charCode = ch.charCodeAt(0);
                        if (charCode > 255) {
                            alert( "Unicode Character '"
                                          + ch
                                          + "' cannot be encoded using standard 
URL encoding.\n" +
                                          "(URL encoding only supports 8-bit 
characters.)\n" +
                                          "A space (+) will be substituted." );
                                encoded += "+";
                        } else {
                                encoded += "%";
                                encoded += HEX.charAt((charCode >> 4) & 0xF);
                                encoded += HEX.charAt(charCode & 0xF);
                        }
                }
        } // for


        return encoded;
}



function generateAddressLink()
{
        var cap = document.getElementById('from3').value;
        var citta = document.getElementById('from2').value;
        var via = document.getElementById('from').value;

        document.getElementById('mailform').style.display = 'block';

        url = "http://maps.google.it/maps?daddr=Largo+Porta+Nuova,
+24122+Bergamo+BG&geocode=&dirflg=&saddr=";

        url = url + URLEncode(via +' '+citta +' '+ cap);

        document.getElementById('url').value = url;
}

function Trim(StrToTrim)
{
    // CONTROLLA CHE IL VALORE IN INPUT SIA DI TIPO STRING
    if (typeof StrToTrim != "string")
    {
        return StrToTrim;
    }

    // CATTURA IL PRIMO CARATTERE DELLA STRINGA PER CONTROLLARE CHE
NON SIA UNO SPAZIO VUOTO
    var StrBlank = StrToTrim.substring(0, 1);

    // ELIMINA LO SPAZIO VUOTO DALLA PRIMA POSIZIONE DELLA STRINGA
    while (StrBlank == " ")
    {
        StrToTrim = StrToTrim.substring(1, StrToTrim.length);
        StrBlank = StrToTrim.substring(0, 1);
    }

    // CATTURA L'ULTIMO CARATTERE DELLA STRINGA PER CONTROLLARE CHE
NON SIA UNO SPAZIO VUOTO
    StrBlank = StrToTrim.substring(StrToTrim.length - 1,
StrToTrim.length);

    // ELIMINA LO SPAZIO VUOTO DALL'ULTIMA POSIZIONE DELLA STRINGA
    while (StrBlank == " ")
    {
        StrToTrim = StrToTrim.substring(0, StrToTrim.length-1);
        StrBlank = StrToTrim.substring(StrToTrim.length-1,
StrToTrim.length);
    }

    // ELIMINA POTENZIALI SPAZI VUOTI MULTIPLI ALL'INIZIO ED ALLA FINE
DI UNA STRINGA
    while (StrToTrim.indexOf("  ") != -1)
    {
        StrToTrim = StrToTrim.substring(0, StrToTrim.indexOf("  "));
        StrToTrim += StrToTrim.substring(StrToTrim.indexOf("  ") + 1,
StrToTrim.length);
    }

    // RESTITUISCE IL VALORE FINALE SENZA SPAZI VUOTI DI CONTORNO
    return StrToTrim;
}


    //]]>
</script>

-------------------------------------------------------------------------------------------------
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to