Here is a small Javascript code that is used with the code already published in the following note "WebDev 15 - Google maps v3 .
In the collection of case: pGestionCartes added the following procedure:
function RechercheCoordonneesDepuisAdresse (sadress, sNomFonction) {
/ / Recovered the function name as a string, so we now retrieves the pointer to this function
objFonction var = eval (sNomFonction)
/ / alert (objFonction)
var geo = new google.maps.Geocoder ();
geo.geocode ({'address': sadress} objFonction)
}
sNomfonction is a function WLanguage local browser to Page example. Here is a sample function: function
LocalRetourRecherche (res, stat) / {
was coordonnee = null;
if (state == google.maps.GeocoderStatus.OK) {
gObjCarte.setCenter (res [0]. geometry.location);
was coordonnee = res [ 0]. geometry.location;
/ / Pour le debuguage the lappli
was marked = new google.maps.Marker ({position: coordonnee, map: gObjCarte, title: 'Address' });
} else {
alert ("Successful Geocode was note for the Follo wing reason:" + state);
}
}
The two parameters (res and stat) are passed automatically by the method geo.geocode.
0 comments:
Post a Comment