]> git.openstreetmap.org Git - nominatim.git/blobdiff - lib/ClassTypes.php
bdd: complete coverage for API tests
[nominatim.git] / lib / ClassTypes.php
index 971f5b93147a5fc35f753d8fb8c9985096c2f19e..bb7b0486cb628c687c342faa9faea86a8032ad5c 100644 (file)
@@ -18,6 +18,8 @@ function getLabelTag($aPlace, $sCountry = null)
         $sLabel = $aPlace['place_type'];
     } elseif ($aPlace['class'] == 'boundary' && $aPlace['type'] == 'administrative') {
         $sLabel = getBoundaryLabel($iRank/2, $sCountry);
         $sLabel = $aPlace['place_type'];
     } elseif ($aPlace['class'] == 'boundary' && $aPlace['type'] == 'administrative') {
         $sLabel = getBoundaryLabel($iRank/2, $sCountry);
+    } elseif ($aPlace['type'] == 'postal_code') {
+        $sLabel = 'postcode';
     } elseif ($iRank < 26) {
         $sLabel = $aPlace['type'];
     } elseif ($iRank < 28) {
     } elseif ($iRank < 26) {
         $sLabel = $aPlace['type'];
     } elseif ($iRank < 28) {
@@ -84,8 +86,17 @@ function getBoundaryLabel($iAdminLevel, $sCountry, $sFallback = 'Administrative'
                                            8 => 'City',
                                            9 => 'City District',
                                            10 => 'Suburb',
                                            8 => 'City',
                                            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])
             );
 
     if (isset($aBoundaryList[$sCountry])
@@ -236,6 +247,24 @@ function getIcon($aPlace)
     return $aIcons[$sClassPlace] ?? null;
 }
 
     return $aIcons[$sClassPlace] ?? null;
 }
 
+/**
+ * Get an icon for the given object with its full URL.
+ */
+function getIconFile($aPlace)
+{
+    if (CONST_MapIcon_URL === false) {
+        return null;
+    }
+
+    $sIcon = getIcon($aPlace);
+
+    if (!isset($sIcon)) {
+        return null;
+    }
+
+    return CONST_MapIcon_URL.'/'.$sIcon.'.p.20.png';
+}
+
 /**
  * Return a class importance value for the given place.
  *
 /**
  * Return a class importance value for the given place.
  *
@@ -250,6 +279,7 @@ function getImportance($aPlace)
 
     if ($aWithImportance === null) {
         $aWithImportance = array_flip(array(
 
     if ($aWithImportance === null) {
         $aWithImportance = array_flip(array(
+                                           'boundary:administrative',
                                            'place:country',
                                            'place:state',
                                            'place:province',
                                            'place:country',
                                            'place:state',
                                            'place:province',