Bonjour,

Voila j'ai un petit soucil : j'uttilise Google Maps mais lorsque je veu réaliser un itinéraire, je rentre par exemple dans un champ : "15 rue Duméril" et dans un autre champ : "6 rue Frannçois Bonvin", il refuse de me trouver l'adresse ! Pouvez vous m'indiquer la cause ?

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
<body onload="initialize();"><form action="#" onsubmit="setDirections(this.from.value, this.to.value); return false">
        <center>
        <table class="tabPerso">
            <tr>
                <th align="right">De:&nbsp;</th>
                <td><input type="text" size="45" id="fromAddress" name="from" value=""/></td>
            </tr>
            <tr>
                <th align="right">&Agrave;:&nbsp;</th>
                <td align="right"><input type="text" size="45" id="toAddress" name="to" value="" /></td>
            </tr>
            <tr>
                <td colspan="2"><input name="submit" type="submit" value="Valider" /></td>
            </tr>
        </table>
        </form></body>
Et mon JS :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
function initialize() {
        if (GBrowserIsCompatible()) {
            map = new GMap2(document.getElementById("map_canvas"));
            gdir = new GDirections(map, document.getElementById("directions"));
 
            GEvent.addListener(gdir, "load", onGDirectionsLoad);
            GEvent.addListener(gdir, "error", handleErrors);
        }
    }
 
function setDirections(fromAddress, toAddress) {
        if(fromAddress == "" || toAddress == "") {
            alert("Les champs doivent être renseignés.");
            return false;
        }
        gdir.load("from: " + fromAddress + ", France to: " + toAddress + ", France");
    }
function handleErrors(){
        if (gdir.getStatus().code == G_GEO_UNKNOWN_ADDRESS)
            alert("Aucune adresse ne correspond à votre recherche.\nMerci de préciser un des lieux.\nError code: " + gdir.getStatus().code);
        else if (gdir.getStatus().code == G_GEO_SERVER_ERROR)
            alert("A geocoding or directions request could not be successfully processed, yet the exact reason for the failure is not known.\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_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("An unknown error occurred.");
 
        map.removeControl(typeControl);
    }
Merci