Skip to content

Commit

Permalink
Cleaned BaseDistance, fix PRS92 parameter vector
Browse files Browse the repository at this point in the history
  • Loading branch information
jtejido committed Apr 29, 2018
1 parent a3178c6 commit 24e17fc
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 15 deletions.
2 changes: 1 addition & 1 deletion src/Geodesy/Datum/BaseDatum.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public function transform(ECEF $ecef): ECEF
// Burka-Wolf simplification of Helmert Transformation
private function helmertTransform(ECEF $ecef): ECEF
{
// if converting back to wgs84, use the inverse
// if converting to wgs84, use the inverse
if ($this instanceof WGS84){
$original = $ecef->getReference();
$array = $original->getDatum(true);
Expand Down
12 changes: 6 additions & 6 deletions src/Geodesy/Datum/PRS92.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ public function datum(): array
{
return array (
'TranslationVectors' => array(
'x' => 127.62195,
'y' => 67.24478,
'z' => 47.04305,
'x' => 127.62153,
'y' => 67.24339,
'z' => 47.04738,
),
'RotationalVectors' => array (
'x' => -1.48722,
'y' => 2.37700,
'z' => 7.64988,
'x' => -3.06803,
'y' => 4.90297,
'z' => 1.57807,
),
'Scale' => 1.06002,
);
Expand Down
10 changes: 2 additions & 8 deletions src/Geodesy/Distance/BaseDistance.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,10 @@ public function __construct(LatLong $source, LatLong $destination)

$this->commonDatum = $destinationDatum;

if($sourceDatum instanceof WGS84) {
if($sourceDatum instanceof WGS84 || $destinationDatum instanceof WGS84) {
$this->transformSourceTo($destinationDatum);
$this->commonDatum = $destinationDatum;
}

if($destinationDatum instanceof WGS84) {
$this->transformSourceTo(new WGS84);
$this->commonDatum = new WGS84;
}
if(!$sourceDatum instanceof WGS84 && !$destinationDatum instanceof WGS84) {
if(!$sourceDatum instanceof $destinationDatum) {
// convert to WGS84 first, then to destination's datum
Expand Down Expand Up @@ -101,7 +96,6 @@ private function transformSourceTo(DatumInterface $datum)
$new_ecef = $datum->transform($source_ecef);
$ecef2lla = new ECEF2LLA($new_ecef);
$this->source = $ecef2lla->convert();

}

protected function getSemiMajorAxis(): float
Expand All @@ -119,7 +113,7 @@ protected function getInverseFlattening(): float
return $this->commonDatum->getInverseFlattening();
}

public function isInRange(float $range)
public function isInRange(float $range): bool
{
return $this->getDistance() <= $this->getUnit()->convert($range);
}
Expand Down

0 comments on commit 24e17fc

Please sign in to comment.