]> git.openstreetmap.org Git - nominatim.git/commitdiff
Merge remote-tracking branch 'upstream/master'
authorSarah Hoffmann <lonvia@denofr.de>
Sun, 19 Aug 2018 16:09:03 +0000 (18:09 +0200)
committerSarah Hoffmann <lonvia@denofr.de>
Sun, 19 Aug 2018 16:09:03 +0000 (18:09 +0200)
lib/ReverseGeocode.php
osm2pgsql
test/php/Nominatim/SearchContextTest.php

index 0500df937c2431ea3a2abc2cd15106044b5ea0d9..681403a19eff902d389fb8feba18e61b5b489a8d 100644 (file)
@@ -117,7 +117,7 @@ class ReverseGeocode
             $sSQL .= ' AND class = \'place\' AND type != \'postcode\'';
             $sSQL .= ' AND name IS NOT NULL ';
             $sSQL .= ' and indexed_status = 0 and linked_place_id is null';
-            $sSQL .= ' AND ST_DWithin('.$sPointSQL.', geometry, 5.0)) p ';
+            $sSQL .= ' AND ST_DWithin('.$sPointSQL.', geometry, 1.8)) p ';
             $sSQL .= 'WHERE distance <= reverse_place_diameter(rank_search)';
             $sSQL .= ' ORDER BY rank_search DESC, distance ASC';
             $sSQL .= ' LIMIT 1';
index 759657e11bbf10bbd305102f659ce8288ee04e7d..93b73e5f5c3b20e80027ecf272f553d26f49f2e8 160000 (submodule)
--- a/osm2pgsql
+++ b/osm2pgsql
@@ -1 +1 @@
-Subproject commit 759657e11bbf10bbd305102f659ce8288ee04e7d
+Subproject commit 93b73e5f5c3b20e80027ecf272f553d26f49f2e8
index 2a74dc41c5b6a21cb14bab50257b95e5e19c309f..db0b2dee1de20c4338f6cbd9d3ba1f6c42ec254a 100644 (file)
@@ -50,4 +50,34 @@ class SearchContextTest extends \PHPUnit_Framework_TestCase
             $this->oCtx->distanceSQL('foo')
         );
     }
+
+    public function testSetViewboxFromBox()
+    {
+        $viewbox = array(30, 20, 40, 50);
+        $this->oCtx->setViewboxFromBox($viewbox, true);
+        $this->assertEquals(
+            'ST_SetSRID(ST_MakeBox2D(ST_Point(30.000000,20.000000),ST_Point(40.000000,50.000000)),4326)',
+            $this->oCtx->sqlViewboxSmall
+        );
+        // height: 10
+        // width: 30
+        $this->assertEquals(
+            'ST_SetSRID(ST_MakeBox2D(ST_Point(50.000000,80.000000),ST_Point(20.000000,-10.000000)),4326)',
+            $this->oCtx->sqlViewboxLarge
+        );
+
+
+        $viewbox = array(-1.5, -2, 1.5, 2);
+        $this->oCtx->setViewboxFromBox($viewbox, true);
+        $this->assertEquals(
+            'ST_SetSRID(ST_MakeBox2D(ST_Point(-1.500000,-2.000000),ST_Point(1.500000,2.000000)),4326)',
+            $this->oCtx->sqlViewboxSmall
+        );
+        // height: 3
+        // width: 4
+        $this->assertEquals(
+            'ST_SetSRID(ST_MakeBox2D(ST_Point(4.500000,6.000000),ST_Point(-4.500000,-6.000000)),4326)',
+            $this->oCtx->sqlViewboxLarge
+        );
+    }
 }