public function inverse($p) { $x = $p->x - $this->x0; $y = $p->y - $this->y0; $lon; $lat; if ($this->sphere) { $lat = Proj4php::$common->HALF_PI - 2.0 * atan(exp(-$y / $this->a * $this->k0)); } else { $ts = exp(-$y / ($this->a * $this->k0)); $lat = Proj4php::$common . phi2z($this->e, $ts); if ($lat == -9999) { Proj4php::reportError("merc:inverse: lat = -9999"); return null; } } $lon = Proj4php::$common->adjust_lon($this->long0 + $x / ($this->a * $this->k0)); $p->x = $lon; $p->y = $lat; return $p; }
public function lcc2ll($coords) { $x = $coords[0] - $this->false_easting; $y = $this->rh - $coords[1] + $this->false_northing; 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->r_major * $this->f0), $con); $lat = phi2z($this->e, $ts); if ($lat == -9999) { return null; } } else { $lat = -HALF_PI; } $lon = adjust_lon($theta / $this->ns + $this->center_lon); return array(R2D * $lon, R2D * $lat); }