]> git.openstreetmap.org Git - nominatim.git/commitdiff
add `<addresspart_type>:ISO3166-2` field to response address details
authorArtem Ziablytskyi <a.ziablytskyi@sportradar.com>
Mon, 17 Jan 2022 16:20:06 +0000 (17:20 +0100)
committerSarah Hoffmann <lonvia@denofr.de>
Thu, 7 Apr 2022 14:37:51 +0000 (16:37 +0200)
VAGRANT.md
docs/api/Output.md
lib-php/AddressDetails.php
test/php/Nominatim/AddressDetailsTest.php
test/php/fixtures/address_details_10_downing_street.json
vagrant/Install-on-Ubuntu-20.sh

index b10a5ac779cc9e9fe756f7e375e838ad0a37a827..d26b8dbd75487520ae61462343cbe6e52c391390 100644 (file)
@@ -44,7 +44,7 @@ is.
       # inside the virtual machine:
       cd build
       wget --no-verbose --output-document=/tmp/monaco.osm.pbf http://download.geofabrik.de/europe/monaco-latest.osm.pbf
-      ./utils/setup.php --osm-file /tmp/monaco.osm.pbf --osm2pgsql-cache 1000 --all 2>&1 | tee monaco.$$.log
+      nominatim import --osm-file /tmp/monaco.osm.pbf
       ```
 
     To repeat an import you'd need to delete the database first
index 3c541d33afe18c51c09bf88ac9b54e78431b3210..d3ecf8d7570f6c066cc0aa898ac19cf2a70ed6f6 100644 (file)
@@ -28,7 +28,7 @@ a single place (for reverse) of the following format:
       "city": "London",
       "state_district": "Greater London",
       "state": "England",
-      "state_code": "ENG",
+      "ISO3166-2": "GB-ENG",
       "postcode": "SW1A 2DU",
       "country": "United Kingdom",
       "country_code": "gb"
index a1a2a636156e686843b4fcebc46f5a236383a85a..657dc3e26a687af457d7c82f40c5ace30d07c1aa 100644 (file)
@@ -93,8 +93,8 @@ class AddressDetails
             ) {
                 $aAddress[$sTypeLabel] = $sName;
 
-                if ('state' === $sTypeLabel && !empty($aLine['name'])) {
-                    $this->addStateCode($aAddress, $aLine['name']);
+                if (!empty($aLine['name'])) {
+                    $this->addStateCode($aAddress, $sTypeLabel, $aLine['name']);
                 }
             }
         }
@@ -182,14 +182,13 @@ class AddressDetails
     /**
      * Add `state_code` field to address details to represent second part of ISO 3166-2 country subdivision code
      */
-    private function addStateCode(&$aAddress, $nameDetails)
+    private function addStateCode(&$aAddress, $sTypeLabel, $nameDetails)
     {
         if (is_string($nameDetails)) {
             $nameDetails = json_decode('{' . str_replace('"=>"', '":"', $nameDetails) . '}', true);
         }
-
-        if (!empty($nameDetails['ref'])) {
-            $aAddress['state_code'] = $nameDetails['ref'];
+        if (!empty($nameDetails['ISO3166-2'])) {
+            $aAddress["$sTypeLabel:ISO3166-2"] = $nameDetails['ISO3166-2'];
         }
     }
 }
index 4cf363448b3e8fd50ec126ea4635528d054485b9..02813286bb0c0a9b94fe7a4fcb556fb95eb6cfba 100644 (file)
@@ -86,7 +86,7 @@ class AddressDetailsTest extends \PHPUnit\Framework\TestCase
                      'city' => 'London',
                      'state_district' => 'Greater London',
                      'state' => 'England',
-                     'state_code' => 'ENG',
+                     'state:ISO3166-2' => 'GB-ENG',
                      'postcode' => 'SW1A 2AA',
                      'country' => 'United Kingdom',
                      'country_code' => 'gb'
index f56cfd9a6ab7f7614ec77280ed8ad6a682e9d4d3..0a56beeced93c7805677e3fc787948b9c5cd0903 100644 (file)
 {"place_id":194325361,
  "osm_type":"R",
  "osm_id":58447,
- "name":{"ref": "ENG", "name": "England", "name:be": "Англія", "name:br": "Bro-Saoz", "name:ca": "Anglaterra", "name:cs": "Anglie", "name:cy": "Lloegr", "name:de": "England", "name:el": "Αγγλία", "name:en": "England", "name:eo": "Anglujo", "name:es": "Inglaterra", "name:fi": "Englanti", "name:fr": "Angleterre", "name:fy": "Ingelân", "name:ga": "Sasana", "name:gd": "Sasainn", "name:gv": "Sostyn", "name:he": "אנגליה", "name:hu": "Anglia", "name:ia": "Anglaterra", "name:io": "Anglia", "name:it": "Inghilterra", "name:la": "Anglia", "name:lt": "Anglija", "name:nl": "Engeland", "name:pl": "Anglia", "name:pt": "Inglaterra", "name:ru": "Англия", "name:sk": "Anglicko", "name:sv": "England", "name:tr": "İngiltere", "name:uk": "Англія", "name:vi": "Anh", "name:vo": "Linglän", "name:zh": "英格蘭", "name:hsb": "Jendźelska", "name:nds": "England", "name:tok": "ma Inli", "name:tzl": "Anglatzara", "alt_name:eo": "Anglio", "alt_name:ia": "Anglia", "old_name:vi": "Anh Quốc", "alt_name:nds": "Ingland", "name:be-tarask": "Ангельшчына", "name:zh-classical": "英格蘭", "name:zh-simplified": "英格兰", "name:zh-traditional": "英格蘭"},
+ "name":{"ref": "ENG", "ISO3166-2": "GB-ENG", "name": "England", "name:be": "Англія", "name:br": "Bro-Saoz", "name:ca": "Anglaterra", "name:cs": "Anglie", "name:cy": "Lloegr", "name:de": "England", "name:el": "Αγγλία", "name:en": "England", "name:eo": "Anglujo", "name:es": "Inglaterra", "name:fi": "Englanti", "name:fr": "Angleterre", "name:fy": "Ingelân", "name:ga": "Sasana", "name:gd": "Sasainn", "name:gv": "Sostyn", "name:he": "אנגליה", "name:hu": "Anglia", "name:ia": "Anglaterra", "name:io": "Anglia", "name:it": "Inghilterra", "name:la": "Anglia", "name:lt": "Anglija", "name:nl": "Engeland", "name:pl": "Anglia", "name:pt": "Inglaterra", "name:ru": "Англия", "name:sk": "Anglicko", "name:sv": "England", "name:tr": "İngiltere", "name:uk": "Англія", "name:vi": "Anh", "name:vo": "Linglän", "name:zh": "英格蘭", "name:hsb": "Jendźelska", "name:nds": "England", "name:tok": "ma Inli", "name:tzl": "Anglatzara", "alt_name:eo": "Anglio", "alt_name:ia": "Anglia", "old_name:vi": "Anh Quốc", "alt_name:nds": "Ingland", "name:be-tarask": "Ангельшчына", "name:zh-classical": "英格蘭", "name:zh-simplified": "英格兰", "name:zh-traditional": "英格蘭"},
  "class":"boundary",
  "type":"administrative",
  "admin_level":4,
index 68bd6b04e287f6ac8615492a13cdd3d535617f4f..06b8b5b813c62fc3436aab535856a08ee4534d75 100755 (executable)
@@ -222,7 +222,7 @@ server {
     listen 80 default_server;
     listen [::]:80 default_server;
 
-    root $USERHOME/nominatim-project/website;
+    root $USERHOME/nominatim/website;
     index search.php index.html;
     location / {
         try_files \$uri \$uri/ @php;