From 975ef0b30526d72cbee90622b61971639b44508b Mon Sep 17 00:00:00 2001 From: Sarah Hoffmann Date: Wed, 1 Apr 2020 21:24:42 +0200 Subject: [PATCH] re-add district to geocodejson --- docs/api/Output.md | 2 +- lib/AddressDetails.php | 4 +++- test/bdd/api/reverse/geocodejson.feature | 4 ++-- test/bdd/api/search/geocodejson.feature | 4 ++-- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/docs/api/Output.md b/docs/api/Output.md index 9871b225..2f9bdaeb 100644 --- a/docs/api/Output.md +++ b/docs/api/Output.md @@ -100,7 +100,7 @@ The following feature attributes are implemented: * `type` - value of the main tag of the object (e.g. residential, restaurant, ...) * `label` - full comma-separated address * `name` - localised name of the place - * `housenumber`, `street`, `locality`, `postcode`, `city`, + * `housenumber`, `street`, `locality`, `district`, `postcode`, `city`, `county`, `state`, `country` - provided when it can be determined from the address * `admin` - list of localised names of administrative boundaries (only with `addressdetails=1`) diff --git a/lib/AddressDetails.php b/lib/AddressDetails.php index 4606bbe2..2aae0742 100644 --- a/lib/AddressDetails.php +++ b/lib/AddressDetails.php @@ -132,8 +132,10 @@ class AddressDetails $aJson['housenumber'] = $aLine['localname']; } else if ($iRank > 25 && $iRank < 28) { $aJson['street'] = $aLine['localname']; - } else if ($iRank >= 17 && $iRank <= 25) { + } else if ($iRank >= 22 && $iRank <= 25) { $aJson['locality'] = $aLine['localname']; + } else if ($iRank >= 17 && $iRank <= 21) { + $aJson['district'] = $aLine['localname']; } else if ($iRank >= 13 && $iRank <= 16) { $aJson['city'] = $aLine['localname']; } else if ($iRank >= 10 && $iRank <= 12) { diff --git a/test/bdd/api/reverse/geocodejson.feature b/test/bdd/api/reverse/geocodejson.feature index ef2053ae..b32bf1ca 100644 --- a/test/bdd/api/reverse/geocodejson.feature +++ b/test/bdd/api/reverse/geocodejson.feature @@ -23,5 +23,5 @@ Feature: Parameters for Reverse API Scenario: City address with suburb When sending geocodejson reverse coordinates 53.5822,10.0805 Then results contain - | housenumber | street | locality | city | postcode | country | - | 64 | Hinschenfelder Straße | Wandsbek | Hamburg | 22047 | Deutschland | + | housenumber | street | district | city | postcode | country | + | 64 | Hinschenfelder Straße | Wandsbek | Hamburg | 22047 | Deutschland | diff --git a/test/bdd/api/search/geocodejson.feature b/test/bdd/api/search/geocodejson.feature index f9132f70..97cb220b 100644 --- a/test/bdd/api/search/geocodejson.feature +++ b/test/bdd/api/search/geocodejson.feature @@ -23,5 +23,5 @@ Feature: Parameters for Search API Scenario: City address with suburb When sending geocodejson search query "hinschenfelder str 64, wandsbek" with address Then results contain - | housenumber | street | locality | city | postcode | country | - | 64 | Hinschenfelder Straße | Wandsbek | Hamburg | 22047 | Deutschland | + | housenumber | street | district | city | postcode | country | + | 64 | Hinschenfelder Straße | Wandsbek | Hamburg | 22047 | Deutschland | -- 2.39.5