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)
38 if (!$aFeature['place_id']) return '';
40 return '<a href="details.php?place_id='.$aFeature['place_id'].'">'.($sTitle?$sTitle:$aFeature['place_id']).'</a>';
43 function detailsPermaLink($aFeature, $sRefText = false)
45 $sOSMType = formatOSMType($aFeature['osm_type'], false);
48 $sLabel = $sRefText ? $sRefText : $sOSMType.' '.$aFeature['osm_id'];
49 return '<a href="details.php?osmtype='.$aFeature['osm_type'].'&osmid='.$aFeature['osm_id'].'&class='.$aFeature['class'].'">'.$sLabel.'</a>';