use Result class in reverse geocoding

Also simplifies the reverse algorithm slightly by no longer
having an additional distance lookup.
This commit is contained in:
Sarah Hoffmann
2017-10-20 15:41:26 +02:00
parent 42f079c355
commit 1424e8e29b
5 changed files with 131 additions and 127 deletions

View File

@@ -615,3 +615,23 @@ function createPointsAroundCenter($fLon, $fLat, $fRadius)
}
return $aPolyPoints;
}
function closestHouseNumber($aRow)
{
$fHouse = $aRow['startnumber']
+ ($aRow['endnumber'] - $aRow['startnumber']) * $aRow['fraction'];
switch ($aRow['interpolationtype']) {
case 'odd':
$iHn = (int)($fHouse/2) * 2 + 1;
break;
case 'even':
$iHn = (int)(round($fHouse/2)) * 2;
break;
default:
$iHn = (int)(round($fHouse));
break;
}
return max(min($aRow['endnumber'], $iHn), $aRow['startnumber']);
}