Example #1
0
 public function testDatum()
 {
     Proj4php::setDebug(false);
     $proj4 = new Proj4php();
     $projWGS84 = new Proj('EPSG:4326', $proj4);
     $projED50 = new Proj('GEOGCS["ED50",DATUM["European_Datum_1950",SPHEROID["International 1924",6378388,297,AUTHORITY["EPSG","7022"]],AUTHORITY["EPSG","6230"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.01745329251994328,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4230"]]', $proj4);
     // from http://www.ihsenergy.com/epsg/guid7.pdf
     // Chapter 2.3.2
     // 53°48'33.82"N
     // 2°07'46.38"E
     $pointWGS84 = new Point(deg2rad(53.809189444), deg2rad(2.129455), $projWGS84);
     $proj4->datum_transform($projWGS84->datum, $projED50->datum, $pointWGS84);
     $this->assertEquals(deg2rad(53.809189444), $pointWGS84->x, '', 0.1);
     $this->assertEquals(deg2rad(2.129455), $pointWGS84->y, '', 0.1);
 }