$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';
$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
+ );
+ }
}