public function init() { if (abs($this->lat1 + $this->lat2) < Sourcemap_Proj::EPSLN) { throw new Exception("Equal latitudes."); } $this->temp = $this->b / $this->a; $this->es = 1.0 - pow($this->temp, 2); $this->e3 = sqrt($this->es); $this->sin_po = sin($this->lat1); $this->cos_po = cos($this->lat1); $this->t1 = $this->sin_po; $this->con = $this->sin_po; $this->ms1 = Sourcemap_Proj::msfnz($this->e3, $this->sin_po, $this->cos_po); $this->qs1 = Sourcemap_Proj::qsfnz($this->e3, $this->sin_po, $this->cos_po); $this->sin_po = sin($this->lat2); $this->cos_po = cos($this->lat2); $this->t2 = $this->sin_po; $this->ms2 = Sourcemap_Proj::msfnz($this->e3, $this->sin_po, $this->cos_po); $this->qs2 = Sourcemap_Proj::qsfnz($this->e3, $this->sin_po, $this->cos_po); $this->sin_po = sin($this->lat0); $this->cos_po = cos($this->lat0); $this->t3 = $this->sin_po; $this->qs0 = Sourcemap_Proj::qsfnz($this->e3, $this->sin_po, $this->cos_po); if (abs($this->lat1 - $this->lat2) > Sourcemap_Proj::EPSLN) { $this->ns0 = ($this->ms1 * $this->ms1 - $this->ms2 * $this->ms2) / ($this->qs2 - $this->qs1); } else { $this->ns0 = $this->con; } $this->c = $this->ms1 * $this->ms1 + $this->ns0 * $this->qs1; $this->rh = $this->a * sqrt($this->c - $this->ns0 * $this->qs0) / $this->ns0; }
public function init() { $proj = $this->_proj; if ($proj->lat_ts) { if ($proj->sphere) { $proj->k0 = cos($proj->lat_ts); } else { $proj->k0 = Sourcemap_Proj::msfnz($proj->es, sin($proj->lat_ts), cos($proj->lat_ts)); } } }
public function init() { // array of: r_maj,r_min,lat1,lat2,c_lon,c_lat,false_east,false_north //double c_lat; /* center latitude */ //double c_lon; /* center longitude */ //double lat1; /* first standard parallel */ //double lat2; /* second standard parallel */ //double r_maj; /* major axis */ //double r_min; /* minor axis */ //double false_east; /* x offset in meters */ //double false_north; /* y offset in meters */ if (!$this->_proj->lat2) { $this->_proj->lat2 = $this->_proj->lat0; } //if lat2 is not defined if (!$this->_proj->k0) { $this->_proj->k0 = 1.0; } // Standard Parallels cannot be equal and on opposite sides of the equator if (abs($this->_proj->lat1 + $this->_proj->lat2) < Sourcemap_Proj::EPSLN) { throw new Exception("Equal Latitudes"); } $temp = $this->_proj->b / $this->_proj->a; $this->_proj->e = sqrt(1.0 - temp * temp); $sin1 = sin($this->_proj->lat1); $cos1 = cos($this->_proj->lat1); $ms1 = Sourcemap_Proj::msfnz($this->_proj->e, sin1, cos1); $ts1 = Sourcemap_Proj::tsfnz($this->_proj->e, $this->_proj->lat1, sin1); $sin2 = sin($this->_proj->lat2); $cos2 = cos($this->_proj->lat2); $ms2 = Sourcemap_Proj::msfnz($this->_proj->e, sin2, cos2); $ts2 = Sourcemap_Proj::tsfnz($this->_proj->e, $this->_proj->lat2, sin2); $ts0 = Sourcemap_Proj::tsfnz($this->_proj->e, $this->_proj->lat0, sin($this->_proj->lat0)); if (abs($this->_proj->lat1 - $this->_proj->lat2) > Sourcemap_Proj::EPSLN) { $this->_proj->ns = log(ms1 / ms2) / log(ts1 / ts2); } else { $this->_proj->ns = sin1; } $this->_proj->f0 = ms1 / ($this->_proj->ns * pow(ts1, $this->_proj->ns)); $this->_proj->rh = $this->_proj->a * $this->_proj->f0 * pow(ts0, $this->_proj->ns); if (!$this->_proj->title) { $this->_proj->title = "Lambert Conformal Conic"; } }
public function init() { if (!$this->mode) { $this->mode = 0; } //chosen default mode $this->temp = $this->b / $this->a; $this->es = 1.0 - pow($this->temp, 2); $this->e = sqrt($this->es); $this->e0 = Sourcemap_Proj::e0fn($this->es); $this->e1 = Sourcemap_Proj::e1fn($this->es); $this->e2 = Sourcemap_Proj::e2fn($this->es); $this->e3 = Sourcemap_Proj::e3fn($this->es); $this->sinphi = sin($this->lat1); $this->cosphi = cos($this->lat1); $this->ms1 = Sourcemap_Proj::msfnz($this->e, $this->sinphi, $this->cosphi); $this->ml1 = Sourcemap_Proj::mlfn($this->e0, $this->e1, $this->e2, $this->e3, $this->lat1); /* format B ---------*/ if ($this->mode != 0) { if (abs($this->lat1 + $this->lat2) < Sourcemap_Proj::EPSLN) { throw new Exception("Equal latitudes."); } $this->sinphi = sin($this->lat2); $this->cosphi = cos($this->lat2); $this->ms2 = Sourcemap_Proj::msfnz($this->e, $this->sinphi, $this->cosphi); $this->ml2 = Sourcemap_Proj::mlfn($this->e0, $this->e1, $this->e2, $this->e3, $this->lat2); if (abs($this->lat1 - $this->lat2) >= Sourcemap_Proj::EPSLN) { $this->ns = ($this->ms1 - $this->ms2) / ($this->ml2 - $this->ml1); } else { $this->ns = $this->sinphi; } } else { $this->ns = $this->sinphi; } $this->g = $this->ml1 + $this->ms1 / $this->ns; $this->ml0 = Sourcemap_Proj::mlfn($this->e0, $this->e1, $this->e2, $this->e3, $this->lat0); $this->rh = $this->a * ($this->g - $this->ml0); }
public function forward($p) { # $sinphi, $cosphi; /* sin and cos value */ # $al; /* temporary values */ # $c; /* temporary values */ # $con, $ml; /* cone constant, small m */ # $ms; /* small m */ # $x, $y; $lon = $p->x; $lat = $p->y; $con = Sourcemap_Proj::adjust_lon($lon - $this->long0); if (abs($lat) <= 1.0E-7) { $x = $this->x0 + $this->a * $con; $y = $this->y0 - $this->a * $this->ml0; } else { $sinphi = sin($lat); $cosphi = cos($lat); $ml = Sourcemap_Proj::mlfn($this->e0, $this->e1, $this->e2, $this->e3, $lat); $ms = Sourcemap_Proj::msfnz($this->e, $sinphi, $cosphi); $con = $sinphi; $x = $this->x0 + $this->a * $ms * sin($con) / $sinphi; $y = $this->y0 + $this->a * ($ml - $this->ml0 + $ms * (1.0 - cos($con)) / $sinphi); } $p->x = $x; $p->y = $y; return $p; }