4 function formatOSMType($sType, $bIncludeExternal = true)
6 if ($sType == 'N') return 'node';
7 if ($sType == 'W') return 'way';
8 if ($sType == 'R') return 'relation';
10 if (!$bIncludeExternal) return '';
12 if ($sType == 'T') return 'way';
13 if ($sType == 'I') return 'way';
18 function osmLink($aFeature, $sRefText = false)
20 $sOSMType = formatOSMType($aFeature['osm_type'], false);
22 return '<a href="//www.openstreetmap.org/'.$sOSMType.'/'.$aFeature['osm_id'].'">'.$sOSMType.' '.($sRefText?$sRefText:$aFeature['osm_id']).'</a>';
27 function wikipediaLink($aFeature)
29 if ($aFeature['wikipedia']) {
30 list($sLanguage, $sArticle) = explode(':', $aFeature['wikipedia']);
31 return '<a href="https://'.$sLanguage.'.wikipedia.org/wiki/'.urlencode($sArticle).'" target="_blank">'.$aFeature['wikipedia'].'</a>';
36 function detailsLink($aFeature, $sTitle = false, $sExtraProperties = false)
38 if (!$aFeature['place_id']) return '';
41 if ($sExtraProperties) {
42 $sHtml .= $sExtraProperties.' ';
45 $sHtml .= 'href="details.php?place_id='.$aFeature['place_id'].'">'.($sTitle?$sTitle:$aFeature['place_id']).'</a>';
50 function detailsPermaLink($aFeature, $sRefText = false, $sExtraProperties = false)
52 $sOSMType = formatOSMType($aFeature['osm_type'], false);
56 if ($sExtraProperties) {
57 $sHtml .= $sExtraProperties.' ';
59 $sHtml .= 'href="details.php?osmtype='.$aFeature['osm_type']
60 .'&osmid='.$aFeature['osm_id'].'&class='.$aFeature['class'].'">';
63 $sHtml .= $sRefText.'</a>';
65 $sHtml .= $sOSMType.' '.$aFeature['osm_id'].'</a>';
70 return detailsLink($aFeature, $sRefText, $sExtraProperties);