]> git.openstreetmap.org Git - nominatim.git/commitdiff
include rank and importance in reverse geocode output
authorBrian Quinion <brian.quinion@mapquest.com>
Thu, 6 Feb 2014 13:09:32 +0000 (13:09 +0000)
committerBrian Quinion <brian.quinion@mapquest.com>
Thu, 6 Feb 2014 13:09:55 +0000 (13:09 +0000)
lib/PlaceLookup.php
lib/template/address-jsonv2.php

index 65aff13eecebcdace754cc7c59217e78ce33cffc..ed2f494d45c41bbc66b3c2dc66a5012f158360c1 100644 (file)
@@ -41,8 +41,8 @@
 
                        $sLanguagePrefArraySQL = "ARRAY[".join(',',array_map("getDBQuoted", $this->aLangPrefOrder))."]";
 
-                       $sSQL = "select placex.place_id, partition, osm_type, osm_id, class, type, admin_level, housenumber, street, isin, postcode, country_code, extratags, parent_place_id, linked_place_id, rank_address, rank_search";
-                       $sSQL .= " importance, indexed_status, indexed_date, wikipedia, calculated_country_code, ";
+                       $sSQL = "select placex.place_id, partition, osm_type, osm_id, class, type, admin_level, housenumber, street, isin, postcode, country_code, extratags, parent_place_id, linked_place_id, rank_address, rank_search";
+                       $sSQL .= " coalesce(importance,0.75-(rank_search::float/40)) as importance, indexed_status, indexed_date, wikipedia, calculated_country_code, ";
                        $sSQL .= " get_address_by_language(place_id, $sLanguagePrefArraySQL) as langaddress,";
                        $sSQL .= " get_name_by_language(name, $sLanguagePrefArraySQL) as placename,";
                        $sSQL .= " get_name_by_language(name, ARRAY['ref']) as ref,";
index baf53129e13aec93d6e470c838d27e343c4061ca..92cf4f1cc5025d830ea92556682f2eb8e746348e 100644 (file)
                 }
                if (isset($aPlace['lat'])) $aFilteredPlaces['lat'] = $aPlace['lat'];
                if (isset($aPlace['lon'])) $aFilteredPlaces['lon'] = $aPlace['lon'];
+
+               $aFilteredPlaces['place_rank'] = $aPlace['rank_search'];
+
                 $aFilteredPlaces['category'] = $aPlace['class'];
                 $aFilteredPlaces['type'] = $aPlace['type'];
+
+               $aFilteredPlaces['importance'] = $aPlace['importance'];
+
                 $aFilteredPlaces['addresstype'] = strtolower($aPlace['addresstype']);
 
                $aFilteredPlaces['display_name'] = $aPlace['langaddress'];