]> git.openstreetmap.org Git - nominatim.git/commitdiff
Revert "cut interpolated housenumbers at range boundaries"
authorSarah Hoffmann <lonvia@denofr.de>
Sun, 15 Jan 2017 20:40:49 +0000 (21:40 +0100)
committerSarah Hoffmann <lonvia@denofr.de>
Sun, 15 Jan 2017 20:40:49 +0000 (21:40 +0100)
This reverts commit e1445c09f308e38c3e630ace2e27df7905ce2d05.

lib/PlaceLookup.php

index c21b1a68c3cfc1b03718c7c360d3228b2e9fc287..eff66fd16f29ae2dffc2d2e28750bcd187846362 100644 (file)
@@ -113,10 +113,10 @@ class PlaceLookup
             if ($this->bNameDetails) $sSQL .= " null as names,";
             $sSQL .= " ST_X(point) as lon, ST_Y(point) as lat from (select *, ST_LineInterpolatePoint(linegeo, (housenumber-startnumber::float)/(endnumber-startnumber)::float) as point from ";
             $sSQL .= " (select *, ";
-            $sSQL .= " GREATEST(startnumber, LEAST(endnumber, CASE WHEN interpolationtype='odd' THEN floor((".$fInterpolFraction."*(endnumber-startnumber)+startnumber)/2)::int*2+1";
+            $sSQL .= " CASE WHEN interpolationtype='odd' THEN floor((".$fInterpolFraction."*(endnumber-startnumber)+startnumber)/2)::int*2+1";
             $sSQL .= " WHEN interpolationtype='even' THEN ((".$fInterpolFraction."*(endnumber-startnumber)+startnumber)/2)::int*2";
             $sSQL .= " WHEN interpolationtype='all' THEN (".$fInterpolFraction."*(endnumber-startnumber)+startnumber)::int";
-            $sSQL .= " END)) as housenumber";
+            $sSQL .= " END as housenumber";
             $sSQL .= " from location_property_tiger where place_id = ".$iPlaceID.") as blub1) as blub2";
         } elseif ($bIsInterpolation) {
             $sSQL = "select place_id, partition, 'W' as osm_type, osm_id, 'place' as class, 'house' as type, null admin_level, housenumber, null as street, null as isin, postcode,";
@@ -129,10 +129,10 @@ class PlaceLookup
             if ($this->bNameDetails) $sSQL .= " null as names,";
             $sSQL .= " ST_X(point) as lon, ST_Y(point) as lat from (select *, ST_LineInterpolatePoint(linegeo, (housenumber-startnumber::float)/(endnumber-startnumber)::float) as point from ";
             $sSQL .= " (select *, ";
-            $sSQL .= " GREATEST(startnumber, LEAST(endnumber, CASE WHEN interpolationtype='odd' THEN floor((".$fInterpolFraction."*(endnumber-startnumber)+startnumber)/2)::int*2+1";
+            $sSQL .= " CASE WHEN interpolationtype='odd' THEN floor((".$fInterpolFraction."*(endnumber-startnumber)+startnumber)/2)::int*2+1";
             $sSQL .= " WHEN interpolationtype='even' THEN ((".$fInterpolFraction."*(endnumber-startnumber)+startnumber)/2)::int*2";
             $sSQL .= " WHEN interpolationtype='all' THEN (".$fInterpolFraction."*(endnumber-startnumber)+startnumber)::int";
-            $sSQL .= " END)) as housenumber";
+            $sSQL .= " END as housenumber";
             $sSQL .= " from location_property_osmline where place_id = ".$iPlaceID.") as blub1) as blub2";
             // testcase: interpolationtype=odd, startnumber=1000, endnumber=1006, fInterpolFraction=1 => housenumber=1007 => error in st_lineinterpolatepoint
             // but this will never happen, because if the searched point is that close to the endnumber, the endnumber house will be directly taken from placex (in ReverseGeocode.php line 220)