From: Sarah Hoffmann Date: Fri, 16 May 2014 09:23:05 +0000 (+0200) Subject: Merge branch 'place-in-addressdetails' of https://github.com/lonvia/Nominatim X-Git-Tag: v2.3.0~31 X-Git-Url: https://git.openstreetmap.org./nominatim.git/commitdiff_plain/ea48e50c60e3d09030d95a005bd679985e708eca?hp=71883fc3410127b97ae0524ca07a187e125d7801 Merge branch 'place-in-addressdetails' of https://github.com/lonvia/Nominatim --- diff --git a/lib/PlaceLookup.php b/lib/PlaceLookup.php index ed2f494d..e0016337 100644 --- a/lib/PlaceLookup.php +++ b/lib/PlaceLookup.php @@ -124,7 +124,7 @@ { $sTypeLabel = strtolower(isset($aTypeLabel['simplelabel'])?$aTypeLabel['simplelabel']:$aTypeLabel['label']); $sTypeLabel = str_replace(' ','_',$sTypeLabel); - if (!isset($aAddress[$sTypeLabel]) || (isset($aFallback[$sTypeLabel]) && $aFallback[$sTypeLabel])) + if (!isset($aAddress[$sTypeLabel]) || (isset($aFallback[$sTypeLabel]) && $aFallback[$sTypeLabel]) || $aLine['class'] == 'place') { $aAddress[$sTypeLabel] = $aLine['localname']?$aLine['localname']:$aLine['housenumber']; } diff --git a/lib/lib.php b/lib/lib.php index 268c7558..afcc02ef 100644 --- a/lib/lib.php +++ b/lib/lib.php @@ -788,7 +788,7 @@ { $sTypeLabel = strtolower(isset($aTypeLabel['simplelabel'])?$aTypeLabel['simplelabel']:$aTypeLabel['label']); $sTypeLabel = str_replace(' ','_',$sTypeLabel); - if (!isset($aAddress[$sTypeLabel]) || (isset($aFallback[$sTypeLabel]) && $aFallback[$sTypeLabel])) + if (!isset($aAddress[$sTypeLabel]) || (isset($aFallback[$sTypeLabel]) && $aFallback[$sTypeLabel]) || $aLine['class'] == 'place') { $aAddress[$sTypeLabel] = $aLine['localname']?$aLine['localname']:$aLine['housenumber']; } diff --git a/sql/functions.sql b/sql/functions.sql index 82023671..1da46920 100644 --- a/sql/functions.sql +++ b/sql/functions.sql @@ -2518,7 +2518,9 @@ BEGIN FOR location IN select placex.place_id, osm_type, osm_id, CASE WHEN class = 'place' and type = 'postcode' THEN hstore('name', postcode) ELSE name END as name, - class, type, admin_level, fromarea, isaddress, + CASE WHEN extratags ? 'place' THEN 'place' ELSE class END as class, + CASE WHEN extratags ? 'place' THEN extratags->'place' ELSE type END as type, + admin_level, fromarea, isaddress, CASE WHEN address_place_id = for_place_id AND rank_address = 0 THEN 100 WHEN rank_address = 11 THEN 5 ELSE rank_address END as rank_address, distance,calculated_country_code,postcode from place_addressline join placex on (address_place_id = placex.place_id)