X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/df463f4ea6fb4767945b95e9ecba603146677474..228ef1972a915d1f960e021f4496147645e22370:/lib/template/details-html.php?ds=sidebyside diff --git a/lib/template/details-html.php b/lib/template/details-html.php index dedf52f3..43ec1266 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)).''; + } } } @@ -46,8 +51,7 @@ function hash_to_subtable($aAssociatedList) { $sHTML = ''; - foreach($aAssociatedList as $sKey => $sValue) - { + foreach ($aAssociatedList as $sKey => $sValue) { $sHTML = $sHTML.'
There are more child objects which are not shown.
'; } } @@ -249,7 +253,7 @@ 'lon' => $aPointDetails['lon'], 'lat' => $aPointDetails['lat'], ); - echo 'var nominatim_result = ' . json_encode($aPlace, JSON_PRETTY_PRINT) . ';'; + echo 'var nominatim_result = ' . json_encode($aPlace, JSON_PRETTY_PRINT) . ';'; ?>