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';
20 function osmLink($aFeature, $sRefText = false)
22 $sOSMType = formatOSMType($aFeature['osm_type'], false);
24 return '<a href="//www.openstreetmap.org/'.$sOSMType.'/'.$aFeature['osm_id'].'">'.$sOSMType.' '.($sRefText?$sRefText:$aFeature['osm_id']).'</a>';
29 function wikipediaLink($aFeature)
31 if ($aFeature['wikipedia']) {
32 list($sLanguage, $sArticle) = explode(':', $aFeature['wikipedia']);
33 return '<a href="https://'.$sLanguage.'.wikipedia.org/wiki/'.urlencode($sArticle).'" target="_blank">'.$aFeature['wikipedia'].'</a>';
38 function detailsLink($aFeature, $sTitle = false, $sExtraProperties = false)
40 if (!$aFeature['place_id']) return '';
43 if ($sExtraProperties) {
44 $sHtml .= $sExtraProperties.' ';
47 $sHtml .= 'href="details.php?place_id='.$aFeature['place_id'].'">'.($sTitle?$sTitle:$aFeature['place_id']).'</a>';
52 function detailsPermaLink($aFeature, $sRefText = false, $sExtraProperties = false)
54 $sOSMType = formatOSMType($aFeature['osm_type'], false);
58 if ($sExtraProperties) {
59 $sHtml .= $sExtraProperties.' ';
61 $sHtml .= 'href="details.php?osmtype='.$aFeature['osm_type']
62 .'&osmid='.$aFeature['osm_id'].'&class='.$aFeature['class'].'">';
65 $sHtml .= $sRefText.'</a>';
67 $sHtml .= $sOSMType.' '.$aFeature['osm_id'].'</a>';
72 return detailsLink($aFeature, $sRefText, $sExtraProperties);