/** * Function: deriveConstants * Sets several derived constant values and initialization of datum and ellipse parameters. * */ public function deriveConstants() { if (isset($this->nagrids) && $this->nagrids == '@null') { $this->datumCode = 'none'; } if (isset($this->datumCode) && $this->datumCode != 'none') { $datumDef = Proj4php::$datum[$this->datumCode]; if (is_array($datumDef)) { $this->datum_params = array_key_exists('towgs84', $datumDef) ? explode(',', $datumDef['towgs84']) : null; $this->ellps = $datumDef['ellipse']; $this->datumName = array_key_exists('datumName', $datumDef) ? $datumDef['datumName'] : $this->datumCode; } } if (!isset($this->a)) { // do we have an ellipsoid? if (!isset($this->ellps) || strlen($this->ellps) == 0 || !array_key_exists($this->ellps, Proj4php::$ellipsoid)) { $ellipse = Proj4php::$ellipsoid['WGS84']; } else { $ellipse = Proj4php::$ellipsoid[$this->ellps]; } Proj4php::extend($this, $ellipse); } if (isset($this->rf) && !isset($this->b)) { $this->b = (1.0 - 1.0 / $this->rf) * $this->a; } if (isset($this->rf) && $this->rf === 0 || abs($this->a - $this->b) < Proj4php::$common->EPSLN) { $this->sphere = true; $this->b = $this->a; } $this->a2 = $this->a * $this->a; // used in geocentric $this->b2 = $this->b * $this->b; // used in geocentric $this->es = ($this->a2 - $this->b2) / $this->a2; // e ^ 2 $this->e = sqrt($this->es); // eccentricity if (isset($this->R_A)) { $this->a *= 1.0 - $this->es * (Proj4php::$common->SIXTH + $this->es * (Proj4php::$common->RA4 + $this->es * Proj4php::$common->RA6)); $this->a2 = $this->a * $this->a; $this->b2 = $this->b * $this->b; $this->es = 0.0; } $this->ep2 = ($this->a2 - $this->b2) / $this->b2; // used in geocentric if (!isset($this->k0)) { $this->k0 = 1.0; } //default value //DGR 2010-11-12: axis if (!isset($this->axis)) { $this->axis = "enu"; } $this->datum = new Proj4phpDatum($this); }