/**
  * @acl access public
  */
 public function preview()
 {
     try {
         $post = $this->getBodyParams();
         if (empty($post) || empty($post['referencePoints'])) {
             throw new Exception('No reference points found.', 404);
         }
         if (count($post['referencePoints']) < 3) {
             throw new Exception('Not enough reference points. Minimum number of reference points required are 3.', 404);
         }
         if (empty($post['image'])) {
             throw new Exception('No image found.', 404);
         }
         if (empty($post['storeName'])) {
             throw new Exception('No store name found.', 404);
         }
         if (!is_file('/assets/images/' . $post['storeName'] . '_geo_warp.tiff')) {
             $config = $this->getDi()->get('config');
             $gdal = new Gdal($config);
             $gdal->setImage($post['image'])->setCoverageStore($post['storeName'])->setReferencePoints($post['referencePoints']);
             return $gdal->convert();
         }
         return ['store' => $post['storeName']];
     } catch (Exception $ex) {
         return $ex->getMessage();
     }
 }
Exemple #2
0
 public function gdalConvert($post)
 {
     $config = $this->getDi()->get(Application::DI_CONFIG);
     $gdal = new \Georeferencer\Resources\Gdal($config);
     $gdal->setImage($post['image'])->setCoverageStore($post['storeName'])->setReferencePoints($post['referencePoints']);
     $gdal->convert();
 }