Exemplo n.º 1
0
 public function before()
 {
     parent::before();
     // If zoom/x/y are passwed get bounding box
     $zoom = $this->request->param('zoom', FALSE);
     $x = $this->request->param('x', FALSE);
     $y = $this->request->param('y', FALSE);
     if ($zoom !== FALSE and $x !== FALSE and $y !== FALSE) {
         $this->_boundingbox = Util_Tile::tileToBoundingBox($zoom, $x, $y);
         $this->request->query('bbox', implode(',', $this->_boundingbox->as_array()));
     }
 }
Exemplo n.º 2
0
 /**
  * Test tileToBoundingBox
  *
  * @return void
  */
 public function test_tileToBoundingBox()
 {
     $bb = Util_Tile::tileToBoundingBox(0, 0, 0);
     $this->assertAttributeEquals(85.05110000000001, 'north', $bb, '', 0.0002);
     $this->assertAttributeEquals(-85.05110000000001, 'south', $bb, '', 0.0002);
     $this->assertAttributeEquals(-180, 'west', $bb, '', 0.0002);
     $this->assertAttributeEquals(180, 'east', $bb, '', 0.0002);
     $bb = Util_Tile::tileToBoundingBox(1, 1, 1);
     $this->assertAttributeEquals(0, 'north', $bb, '', 0.0002);
     $this->assertAttributeEquals(-85.05110000000001, 'south', $bb, '', 0.0002);
     $this->assertAttributeEquals(0, 'west', $bb, '', 0.0002);
     $this->assertAttributeEquals(180, 'east', $bb, '', 0.0002);
     $bb = Util_Tile::tileToBoundingBox(2, 2, 1);
     $this->assertAttributeEquals(66.51309999999999, 'north', $bb, '', 0.0002);
     $this->assertAttributeEquals(0, 'south', $bb, '', 0.0002);
     $this->assertAttributeEquals(0, 'west', $bb, '', 0.0002);
     $this->assertAttributeEquals(90, 'east', $bb, '', 0.0002);
     $bb = Util_Tile::tileToBoundingBox(8, 13, 14);
     $this->assertAttributeEquals(83.026183, 'north', $bb, '', 0.0002);
     $this->assertAttributeEquals(82.853346, 'south', $bb, '', 0.0002);
     $this->assertAttributeEquals(-161.71875, 'west', $bb, '', 0.0002);
     $this->assertAttributeEquals(-160.3125, 'east', $bb, '', 0.0002);
 }