Subversion Repositories Sites.obs-saisons.fr

Compare Revisions

Ignore whitespace Rev 170 → Rev 171

/trunk/applications/jrest/services/OdsCommune.php
42,7 → 42,7
$infos_altitude_json = file_get_contents('http://maps.googleapis.com/maps/api/elevation/json?sensor=false&locations='.$lat.','.$lon);
$infos_commune_json = file_get_contents("http://ws.geonames.org/findNearbyJSON?featureClass=ADM4&lat=".urlencode($lat)."&lng=".urlencode($lon)."&style=full") ;
 
// à voir l'utilisation de google places lors de la mise en place d'un compte google premier api
//$infos_commune = file_get_contents('https://maps.googleapis.com/maps/api/place/search/json?sensor=false&locations='.$lat.','.$lon);
57,7 → 57,7
$commune = $this->remplacerNomCommunePourRecherche($commune);
$requete_infos_communes = 'SELECT * FROM ods.COMMUNE WHERE COMMUNE_NOM LIKE '.$this->proteger($commune).' ORDER BY COMMUNE_NOM LIMIT 0,10';
$requete_infos_communes = 'SELECT * FROM ods_communes WHERE oc_nom LIKE '.$this->proteger($commune).' ORDER BY oc_nom LIMIT 0,10';
$infos_communes = $this->executerRequete($requete_infos_communes);
104,11 → 104,24
foreach($infos_communes as $commune) {
$cp = $commune['oc_code_insee'];
$limite = 2;
if(strlen($cp) == 4) {
$limite = 1;
}
$dpt = substr($cp,0,$limite);
if($limite == 1) {
$dpt = '0'.$dpt;
}
$infos_formatees[] = array(
'commune' => $commune['COMMUNE_NOM'],
'dpt' => $commune['COMMUNE_CODEPOSTAL'],
'lat' => $commune['COMMUNE_LATITUDE'],
'lon' => $commune['COMMUNE_LONGITUDE']
'commune' => $commune['oc_nom'],
'dpt' => $dpt,
'code_insee' => $commune['oc_code_insee'],
'lat' => $commune['oc_latitude'],
'lon' => $commune['oc_longitude']
);
}
return $infos_formatees;