if (isset($aPlace['place_type'])) {
$sLabel = $aPlace['place_type'];
} elseif ($aPlace['class'] == 'boundary' && $aPlace['type'] == 'administrative') {
- $sLabel = getBoundaryLabel($iRank, $sCountry);
+ $sLabel = getBoundaryLabel($iRank/2, $sCountry);
+ } elseif ($aPlace['type'] == 'postal_code') {
+ $sLabel = 'postcode';
} elseif ($iRank < 26) {
$sLabel = $aPlace['type'];
} elseif ($iRank < 28) {
$sLabel = $aPlace['class'];
}
- return strtolower(str_replace('_', ' ', $sLabel));
+ return strtolower(str_replace(' ', '_', $sLabel));
}
/**
}
if ($aPlace['class'] == 'boundary' && $aPlace['type'] == 'administrative') {
- return getBoundaryLabel((int)($aPlace['admin_level'] ?? 15, $sCountry ?? null);
+ return getBoundaryLabel(($aPlace['rank_address'] ?? 30)/2, $sCountry ?? null);
}
// Return a label only for 'important' class/type combinations
- if (isset(getImportance($aPlace)) {
+ if (getImportance($aPlace) !== null) {
return ucwords(str_replace('_', ' ', $aPlace['type']));
}
6 => 'County',
7 => 'Municipality',
8 => 'City',
- 9 => 'City District'
+ 9 => 'City District',
10 => 'Suburb',
- 11 => 'Neighbourhood'
- )
+ 11 => 'Neighbourhood',
+ 12 => 'City Block'
+ ),
+ 'no' => array (
+ 3 => 'State',
+ 4 => 'County'
+ ),
+ 'se' => array (
+ 3 => 'State',
+ 4 => 'County'
+ )
);
if (isset($aBoundaryList[$sCountry])
function getDefRadius($aPlace)
{
$aSpecialRadius = array(
- 'place:continent' => 25
+ 'place:continent' => 25,
'place:country' => 7,
'place:state' => 2.6,
'place:province' => 2.6,
return $aIcons[$sClassPlace] ?? null;
}
+/**
+ * Get an icon for the given object with its full URL.
+ */
+function getIconFile($aPlace)
+{
+ $sIcon = getIcon($aPlace);
+
+ if (!isset($sIcon)) {
+ return null;
+ }
+
+ return CONST_Website_BaseURL.'images/mapicons/'.$sIcon.'.p.20.png';
+}
+
/**
* Return a class importance value for the given place.
*
*/
function getImportance($aPlace)
{
- static $aWithImportance = array_flip(array(
+ static $aWithImportance = null;
+
+ if ($aWithImportance === null) {
+ $aWithImportance = array_flip(array(
'place:country',
'place:state',
'place:province',
'railway:disused_station',
'railway:abandoned',
'railway:disused'
- );
+ ));
+ }
$sClassPlace = $aPlace['class'].':'.$aPlace['type'];