]> git.openstreetmap.org Git - nominatim.git/blob - lib/output.php
take throttled ip stats from build dir
[nominatim.git] / lib / output.php
1 <?php
2
3         function formatOSMType($sType, $bIncludeExternal=true)
4         {
5                 if ($sType == 'N') return 'node';
6                 if ($sType == 'W') return 'way';
7                 if ($sType == 'R') return 'relation';
8
9                 if (!$bIncludeExternal) return '';
10
11                 if ($sType == 'T') return 'tiger';
12                 if ($sType == 'I') return 'way';
13
14                 return '';
15         }
16
17         function osmLink($aFeature, $sRefText=false)
18         {
19                 $sOSMType = formatOSMType($aFeature['osm_type'], false);
20                 if ($sOSMType)
21                 {
22                         return '<a href="//www.openstreetmap.org/'.$sOSMType.'/'.$aFeature['osm_id'].'">'.$sOSMType.' '.($sRefText?$sRefText:$aFeature['osm_id']).'</a>';
23                 }
24                 return '';
25         }
26
27         function wikipediaLink($aFeature)
28         {
29                 if ($aFeature['wikipedia'])
30                 {
31                         list($sLanguage, $sArticle) = explode(':',$aFeature['wikipedia']);
32                         return '<a href="https://'.$sLanguage.'.wikipedia.org/wiki/'.urlencode($sArticle).'" target="_blank">'.$aFeature['wikipedia'].'</a>';
33                 }
34                 return '';
35         }
36
37         function detailsLink($aFeature, $sTitle=false)
38         {
39                 if (!$aFeature['place_id']) return '';
40
41                 return '<a href="details.php?place_id='.$aFeature['place_id'].'">'.($sTitle?$sTitle:$aFeature['place_id']).'</a>';
42         }
43