correcion en nominatim

This commit is contained in:
fredyrivera 2017-09-24 07:55:37 -05:00
parent b931ef2e79
commit 979b28f76d

View File

@ -4251,8 +4251,11 @@ function geocoder($valor,$campo){
$respuesta = new xajaxResponse('utf-8'); $respuesta = new xajaxResponse('utf-8');
if(strlen($valor) > 3) { if(strlen($valor) > 3) {
$valor = urlencode($valor); $valor = urlencode($valor);
$json = "https://nominatim.openstreetmap.org/search.php?format=json&limit=5&addressdetails=1&q=$valor"; $json = "https://nominatim.openstreetmap.org/search.php?format=json&limit=5&addressdetails=1&q=$valor&email=info@tupale.co";
$data = file_get_contents("$json"); $data = file_get_contents("$json");
if ($data=='429 Too Many Requests'){
return $data;
}
$geocoder = json_decode($data, true); $geocoder = json_decode($data, true);
if($data ==="[]") {$vacio=" if($data ==="[]") {$vacio="
<a class='pull-right' onclick=\"xajax_limpia_div('muestra_geocoder'); \"><i class='glyphicon glyphicon-remove-sign'></i></a> <a class='pull-right' onclick=\"xajax_limpia_div('muestra_geocoder'); \"><i class='glyphicon glyphicon-remove-sign'></i></a>