com * License: LGPL as per: http://www.gnu.org/copyleft/lesser.html */ class Proj4phpProjCea { /* Initialize the Cylindrical Equal Area projection ------------------------------------------- */ public function init() { //no-op } /* Cylindrical Equal Area forward equations--mapping lat,long to x,y ------------------------------------------------------------ */ public function forward( $p ) { $lon = $p->x; $lat = $p->y; /* Forward equations ----------------- */ $dlon = Proj4php::$common->adjust_lon( $lon - $this->long0 ); $x = $this->x0 + $this->a * $dlon * cos( $this->lat_ts ); $y = $this->y0 + $this->a * sin( $lat ) / cos( $this->lat_ts ); /* Elliptical Forward Transform Not implemented due to a lack of a matchign inverse function { $Sin_Lat = sin(lat); $Rn = $this->a * (sqrt(1.0e0 - $this->es * Sin_Lat * Sin_Lat )); x = $this->x0 + $this->a * dlon * cos($this->lat_ts); y = $this->y0 + Rn * sin(lat) / cos($this->lat_ts); } */ $p->x = $x; $p->y = $y; return $p; } /** * Cylindrical Equal Area inverse equations--mapping x,y to lat/long * * @param type $p * @return type */ public function inverse( $p ) { $p->x -= $this->x0; $p->y -= $this->y0; $p->x = Proj4php::$common->adjust_lon( $this->long0 + ($p->x / $this->a) / cos( $this->lat_ts ) ); $p->y = asin( ($p->y / $this->a) * cos( $this->lat_ts ) ); return $p; } } Proj4php::$proj['cea'] = new Proj4phpProjCea();