]> git.openstreetmap.org Git - nominatim.git/commitdiff
Merge remote-tracking branch 'upstream/master'
authorSarah Hoffmann <lonvia@denofr.de>
Wed, 3 Sep 2014 19:10:14 +0000 (21:10 +0200)
committerSarah Hoffmann <lonvia@denofr.de>
Wed, 3 Sep 2014 19:10:14 +0000 (21:10 +0200)
lib/Geocode.php
sql/functions.sql

index 5451c3820dee27bafbccba637151aa8e8598689d..6908ac98262cdfd01d73c4e7780e146aadf1e55e 100644 (file)
                                foreach($this->aRoutePoints as $aPoint)
                                {
                                        if (!$bFirst) $sViewboxCentreSQL .= ",";
-                                       $sViewboxCentreSQL .= $aPoint[1].' '.$aPoint[0];
+                                       $sViewboxCentreSQL .= $aPoint[0].' '.$aPoint[1];
                                        $bFirst = false;
                                }
                                $sViewboxCentreSQL .= ")'::geometry,4326)";
                                                                }
                                                        }
                                                        if ($aSearch['sCountryCode']) $aTerms[] = "country_code = '".pg_escape_string($aSearch['sCountryCode'])."'";
-                                                       if ($aSearch['sHouseNumber']) $aTerms[] = "address_rank between 16 and 27";
+                                                       if ($aSearch['sHouseNumber'])
+                                                       {
+                                                               $aTerms[] = "address_rank between 16 and 27";
+                                                       }
+                                                       else
+                                                       {
+                                                               if ($this->iMinAddressRank > 0)
+                                                               {
+                                                                       $aTerms[] = "address_rank >= ".$this->iMinAddressRank;
+                                                               }
+                                                               if ($this->iMaxAddressRank < 30)
+                                                               {
+                                                                       $aTerms[] = "address_rank <= ".$this->iMaxAddressRank;
+                                                               }
+                                                       }
                                                        if ($aSearch['fLon'] && $aSearch['fLat'])
                                                        {
                                                                $aTerms[] = "ST_DWithin(centroid, ST_SetSRID(ST_Point(".$aSearch['fLon'].",".$aSearch['fLat']."),4326), ".$aSearch['fRadius'].")";
index 9b083609675642633929075b1df8bed8aba66e05..7b06b450ac54f6f61c32eb5f169e50f5e5a3a908 100644 (file)
@@ -2352,29 +2352,29 @@ END;
 $$
 LANGUAGE plpgsql IMMUTABLE;
 
-CREATE OR REPLACE FUNCTION get_connected_ways(way_ids INTEGER[]) RETURNS SETOF planet_osm_ways
-  AS $$
-DECLARE
-  searchnodes INTEGER[];
-  location RECORD;
-  j INTEGER;
-BEGIN
-
-  searchnodes := '{}';
-  FOR j IN 1..array_upper(way_ids, 1) LOOP
-    FOR location IN 
-      select nodes from planet_osm_ways where id = way_ids[j] LIMIT 1
-    LOOP
-      IF not (ARRAY[location.nodes] <@ searchnodes) THEN
-        searchnodes := searchnodes || location.nodes;
-      END IF;
-    END LOOP;
-  END LOOP;
-
-  RETURN QUERY select * from planet_osm_ways where nodes && searchnodes and NOT ARRAY[id] <@ way_ids;
-END;
-$$
-LANGUAGE plpgsql IMMUTABLE;
+--CREATE OR REPLACE FUNCTION get_connected_ways(way_ids INTEGER[]) RETURNS SETOF planet_osm_ways
+--  AS $$
+--DECLARE
+--  searchnodes INTEGER[];
+--  location RECORD;
+--  j INTEGER;
+--BEGIN
+--
+--  searchnodes := '{}';
+--  FOR j IN 1..array_upper(way_ids, 1) LOOP
+--    FOR location IN
+--      select nodes from planet_osm_ways where id = way_ids[j] LIMIT 1
+--    LOOP
+--      IF not (ARRAY[location.nodes] <@ searchnodes) THEN
+--        searchnodes := searchnodes || location.nodes;
+--      END IF;
+--    END LOOP;
+--  END LOOP;
+--
+--  RETURN QUERY select * from planet_osm_ways where nodes && searchnodes and NOT ARRAY[id] <@ way_ids;
+--END;
+--$$
+--LANGUAGE plpgsql IMMUTABLE;
 
 CREATE OR REPLACE FUNCTION get_address_postcode(for_place_id BIGINT) RETURNS TEXT
   AS $$