Skip to content

Instantly share code, notes, and snippets.

Created December 5, 2017 09:55
Show Gist options
  • Save anonymous/27da56ce310d896c81083e1f496074c2 to your computer and use it in GitHub Desktop.
Save anonymous/27da56ce310d896c81083e1f496074c2 to your computer and use it in GitHub Desktop.
Projection file
<?php
use PHPCoord\TransverseMercator;
class Concrete_UTM80 extends TransverseMercator
{
protected $prj = '';
protected $easting = 500000;
protected $northing = 0;
protected $latitude = 0;
protected $longitude = 0;
protected $scaleFactor = 0.9996;
function __construct($x, $y, $z, $projection_wkt)
{
$this->prj = $projection_wkt;
parent::__construct($x, $y, $z, PHPCoord\RefEll::grs80());
$this->processProjection();
}
public function getReferenceEllipsoid()
{
return PHPCoord\RefEll::grs80();
}
protected function processProjection()
{
$this->latitude = Latitude_Of_Origin;
$this->longitude = Central_Meridian;
$this->easting = False_Easting;
$this->northing = False_Northing;
$this->scaleFactor = Scale_Factor;
}
public function toLatLng()
{
$N = $this->y;
$E = $this->x;
$N0 = $this->getOriginNorthing();
$E0 = $this->getOriginEasting();
$phi0 = $this->getOriginLatitude();
$lambda0 = $this->getOriginLongitude();
return $this->convertToLatitudeLongitude($N, $E, $N0, $E0, $phi0, $lambda0);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment