コード例 #1
0
ファイル: Lcc.php プロジェクト: rldhont/proj4php
 /**
  * Lambert Conformal Conic inverse equations--mapping x,y to lat/long
  * 
  * @param type $p
  * @return null 
  */
 public function inverse($p)
 {
     $x = ($p->x - $this->x0) / $this->k0;
     $y = $this->rh - ($p->y - $this->y0) / $this->k0;
     if ($this->ns > 0) {
         $rh1 = sqrt($x * $x + $y * $y);
         $con = 1.0;
     } else {
         $rh1 = -sqrt($x * $x + $y * $y);
         $con = -1.0;
     }
     $theta = 0.0;
     if ($rh1 != 0) {
         $theta = atan2($con * $x, $con * $y);
     }
     if ($rh1 != 0 || $this->ns > 0.0) {
         $con = 1.0 / $this->ns;
         $ts = pow($rh1 / ($this->a * $this->f0), $con);
         $lat = Common::phi2z($this->e, $ts);
         if ($lat == -9999) {
             return null;
         }
     } else {
         $lat = -Common::HALF_PI;
     }
     $lon = Common::adjust_lon($theta / $this->ns + $this->long0);
     $p->x = $lon;
     $p->y = $lat;
     return $p;
 }
コード例 #2
0
ファイル: Omerc.php プロジェクト: rldhont/proj4php
 /**
  *
  * @param type $p
  * @return type 
  */
 public function inverse($p)
 {
     /*
     $delta_lon; /* Delta longitude (Given longitude - center 
     $theta;  /* angle
     $delta_theta; /* adjusted longitude
     $sin_phi;
     $cos_phi; /* sin and cos value	
     $b;  /* temporary values
     $c;
     $t;
     $tq; /* temporary values
     $con;
     $n;
     $ml; /* cone constant, small m	
     $vs;
     $us;
     $q;
     $s;
     $ts1;
     $vl;
     $ul;
     $bs;
     $dlon;
     $flag;
     */
     /* Inverse equations
        ----------------- */
     $p->x -= $this->x0;
     $p->y -= $this->y0;
     #$flag = 0;
     $vs = $p->x * $this->cosaz - $p->y * $this->sinaz;
     $us = $p->y * $this->cosaz + $p->x * $this->sinaz;
     $us = $us + $this->u;
     $q = exp(-$this->bl * $vs / $this->al);
     $s = 0.5 * ($q - 1.0 / $q);
     $t = 0.5 * ($q + 1.0 / $q);
     $vl = sin($this->bl * $us / $this->al);
     $ul = ($vl * $this->cosgam + $s * $this->singam) / $t;
     if (abs(abs($ul) - 1.0) <= Common::EPSLN) {
         $lon = $this->longc;
         if (ul >= 0.0) {
             $lat = Common::HALF_PI;
         } else {
             $lat = -Common::HALF_PI;
         }
     } else {
         $con = 1.0 / $this->bl;
         $ts1 = pow($this->el / sqrt((1.0 + $ul) / (1.0 - $ul)), $con);
         $lat = Common::phi2z($this->e, $ts1);
         //if ($flag != 0)
         //return($flag);
         //~ con = cos($this->bl * us /al);
         $theta = $this->longc - atan2($s * $this->cosgam - $vl * $this->singam, $con) / $this->bl;
         $lon = Common::adjust_lon($theta);
     }
     $p->x = $lon;
     $p->y = $lat;
     return $p;
 }
コード例 #3
0
ファイル: Merc.php プロジェクト: rldhont/proj4php
 public function inverse($p)
 {
     $x = $p->x - $this->x0;
     $y = $p->y - $this->y0;
     if ($this->sphere) {
         $lat = Common::HALF_PI - 2.0 * atan(exp(-$y / $this->a * $this->k0));
     } else {
         $ts = exp(-$y / ($this->a * $this->k0));
         $lat = Common::phi2z($this->e, $ts);
         if ($lat == -9999) {
             Proj4php::reportError("merc:inverse: lat = -9999");
             return null;
         }
     }
     $lon = Common::adjust_lon($this->long0 + $x / ($this->a * $this->k0));
     $p->x = $lon;
     $p->y = $lat;
     return $p;
 }