Geocodage : Utilisation adresse courte et longue

This commit is contained in:
Michael RICOIS 2015-09-09 07:48:20 +00:00
parent 85f238b0cb
commit 55e2ac9fd0

View File

@ -948,15 +948,17 @@ class MMap {
8 Address level accuracy. (Since 2.59)
9 Address level accuracy +++
**/
public function geoCodeAdresse($adrNum, $adrIndRep, $adrTypeVoieCourt, $adrTypeVoieLong, $adrLibVoie, $cp, $ville='', $pays='France', $codeRivoli='')
public function geoCodeAdresse($adrNum, $adrIndRep, $adrTypeVoieCourt, $adrTypeVoieLong, $adrLibVoie, $cp, $ville='', $pays='France', $codeRivoli='')
{
$tabRep = array();
$adrNum = str_pad($adrNum, 4, 0, STR_PAD_LEFT);
$adresse = addslashes(trim(preg_replace('/ +/',' ', "$adrNum $adrIndRep $adrTypeVoieLong $adrLibVoie")));
$adresseCourt = addslashes(trim(preg_replace('/ +/',' ', "$adrNum $adrIndRep $adrTypeVoieCourt $adrLibVoie")));
$ville = addslashes($ville);
$ret = $this->iDb->select('jo.zonageXY', 'lat, lon, l93_x, l93_y, alt, precis, adresseValidee, dateInsert',
"address='$adresse' AND adr_cp='$cp' AND adr_ville='$ville'", false, MYSQL_ASSOC);
$ret = $this->iDb->select('jo.zonageXY', 'lat, lon, l93_x, l93_y, alt, precis, adresseValidee, IF(dateUpdate>dateInsert, dateUpdate, dateInsert) AS dateInsert ',
"(address='$adresse' OR address='$adresseCourt') AND adr_cp='$cp' AND adr_ville='$ville' ORDER BY dateInsert DESC LIMIT 1",
false, MYSQL_ASSOC);
//Existe dans la base
if (count($ret)>0) {
$zonage=$ret[0];