src/External/Bag/Api/BagClient.php
public function search($type, Polygon $polygon)
    {
      // Concat url
      $url = self::API_URL . '/' . $type;

      $data = new \StdClass();
      $data->geometrie = new \StdClass();
      $data->geometrie->contains = new \StdClass();
      $data->geometrie->contains->type = 'Point'; // Polygon??
      $data->geometrie->contains->coordinates = [];

      $points = $polygon->getPoints();

      foreach($points as $point)
        $data->geometrie->contains->coordinates[] = [$point->getX(), $point->getY()];

      // Create a REST request
      $request = new \LibX\Net\Rest\Request($url, \LibX\Net\Rest\Request::REQUEST_METHOD_POST);
      $request->setData(json_encode($data));

      // Create a REST response
      $response = new \LibX\Net\Rest\Response();

      // Not working at the moment
      return;

      // Make the call
      $data = $this->call($request, $response);
    }
public function search($type, Polygon $polygon)
    {
      // Concat url
      $url = self::API_URL . '/' . $type;

      $data = new \StdClass();
      $data->geometrie = new \StdClass();
      $data->geometrie->contains = new \StdClass();
      $data->geometrie->contains->type = 'Point'; // Polygon??
      $data->geometrie->contains->coordinates = [];

      $points = $polygon->getPoints();

      foreach($points as $point)
        $data->geometrie->contains->coordinates[] = [$point->getX(), $point->getY()];

      // Create a REST request
      $request = new \LibX\Net\Rest\Request($url, \LibX\Net\Rest\Request::REQUEST_METHOD_POST);
      $request->setData(json_encode($data));

      // Create a REST response
      $response = new \LibX\Net\Rest\Response();

      // Not working at the moment
      return;

      // Make the call
      $data = $this->call($request, $response);
    }
public function search ( $ type , Polygon $ polygon ) { // Concat url $ url = self :: API_URL . '/' . $ type ; $ data = new \ StdClass ( ) ; $ data -> geometrie = new \ StdClass ( ) ; $ data -> geometrie -> contains = new \ StdClass ( ) ; $ data -> geometrie -> contains -> type = 'Point' ; // Polygon?? $ data -> geometrie -> contains -> coordinates = [ ] ; $ points = $ polygon -> getPoints ( ) ; foreach ( $ points as $ point ) $ data -> geometrie -> contains -> coordinates [ ] = [ $ point -> getX ( ) , $ point -> getY ( ) ] ; // Create a REST request $ request = new \ LibX \ Net \ Rest \ Request ( $ url , \ LibX \ Net \ Rest \ Request :: REQUEST_METHOD_POST ) ; $ request -> setData ( json_encode ( $ data ) ) ; // Create a REST response $ response = new \ LibX \ Net \ Rest \ Response ( ) ; // Not working at the moment return ; // Make the call $ data = $ this -> call ( $ request , $ response ) ; }
Search BAG data

@param string $type
@param Polygon $polygon
@return NULL
Search BAG data