Bonjour,
J'utilise drupal et le module pour geocoder une adresse.
Avant j'étais sur infomaniak et tout fonctionnait parfaitement sur ce point.
Maintenant l'encodage d'une adresse en lat-lon ne fonctionne plus.
J'ai réussi à le faire fonctionner une seule fois. Puis impossible.
Du coup en tentant de faire un script php retournant le coordonnée d'une adresse via l'utilisation de l'API google, j'obtiens le fameux message:
"error_message" : "You have exceeded your daily request quota for this API.", "results" : [], "status" : "OVER_QUERY_LIMIT"
J'ai tenté d'utiliser les solutions trouvé sur le net pour débloquer la situation mais rien n'y fait.
Au secours
J
'aimerai déjà que le code suivant fonctionne avant de tenter de debuger le module drupal:
/*
Description : The following code convert the address to co-ordinates using google map api
Author: Dnyanesh Pawar,
Copyright: Dnyanesh Pawar (
http://www.techrecite.com)
Link:
http://www.techrecite.com
See the GNU General Public License for more details:
http://www.creativecommons.org/
*/
// Take the address in a variable
$address = "Capitol Avenue, Elsmere, Kentucky";
// Replace the empty spaces in the address with + sign
// + Sign is the concatanation/separation character used by google map service
$address = str_replace(" ", "+", $address);
echo $address;
$address_url = "http://maps.google.com/maps/api/geocode/json?address=$address&sensor=false";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $address_url);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_PROXYPORT, 3128);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
$response = curl_exec($ch);
echo $response;
curl_close($ch);
$response_a = json_decode($response);
//Print the provided address in Human readable/ complete Postal address;
echo $formatted_address = $response_a->results[0]->formatted_address.'
';
//Print the Latitude and Longitude of the address
echo $lat = $response_a->results[0]->geometry->location->lat.'
';
echo $long = $response_a->results[0]->geometry->location->lng;
//$json=file_get_contents('http://nominatim.openstreetmap.org/search?format=json&limit=1&q=75000 paris');
//$obj = json_decode($json, true);
//$latitude = $obj[0]['lat'];
//$longitude = $obj[0]['lon'];
?>