X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/87c0049e756a90056183f3311c64395fcccfe5a5..2419066aabea73f78c4f21420b26bc0c633998e7:/lib/template/details-html.php diff --git a/lib/template/details-html.php b/lib/template/details-html.php index 9b76efc1..f0798773 100644 --- a/lib/template/details-html.php +++ b/lib/template/details-html.php @@ -20,20 +20,25 @@ } - function format_distance($fDistance) + function format_distance($fDistance, $bInMeters = false) { - // $fDistance is in meters - if ($fDistance < 1) - { - return '0'; - } - elseif ($fDistance < 1000) - { - return'~'.(round($fDistance,0)).' m'; - } - else - { - return'~'.(round($fDistance/1000,1)).' km'; + if ($bInMeters) { + // $fDistance is in meters + if ($fDistance < 1) { + return '0'; + } + elseif ($fDistance < 1000) { + return '~'.(round($fDistance,0)).' m'; + } + else { + return '~'.(round($fDistance/1000,1)).' km'; + } + } else { + if ($fDistance == 0) { + return '0'; + } else { + return ''.(round($fDistance,4)).''; + } } } @@ -60,16 +65,16 @@ } - function _one_row($aAddressLine){ + function _one_row($aAddressLine, $bDistanceInMeters = false){ $bNotUsed = isset($aAddressLine['isaddress']) && !$aAddressLine['isaddress']; echo '