From 48e916b81c6ef37f9e22bbb1c523189071c3c89b Mon Sep 17 00:00:00 2001 From: Doug Wright Date: Sat, 9 Oct 2021 00:23:16 +0100 Subject: [PATCH] Simplify/unify grid implementations --- docs/coordinate_conversions_hard_compound.rst | 12 +- ...coordinate_conversions_hard_geographic.rst | 70 +-- docs/coordinate_conversions_hard_vertical.rst | 22 +- src/CompoundPoint.php | 52 +- .../BilinearInterpolation.php | 10 +- .../BiquadraticInterpolation.php | 64 +++ .../CoordinateOperationMethods.php | 26 +- .../CoordinateOperationParams.php | 538 ++++-------------- src/CoordinateOperation/GTXGrid.php | 50 +- .../GeographicGeoidHeightGrid.php | 26 + src/CoordinateOperation/GeographicGrid.php | 48 ++ src/CoordinateOperation/Grid.php | 31 + src/CoordinateOperation/GridProvider.php | 7 +- src/CoordinateOperation/IGNESHeightGrid.php | 30 +- .../IGNFGeocentricTranslationGrid.php | 13 +- src/CoordinateOperation/IGNFGrid.php | 52 +- src/CoordinateOperation/IGNFHeightGrid.php | 16 +- src/CoordinateOperation/NADCON5Grid.php | 123 +--- src/CoordinateOperation/NADCON5Grids.php | 35 ++ src/CoordinateOperation/NTv2Grid.php | 62 +- src/CoordinateOperation/NTv2SubGrid.php | 21 +- src/CoordinateOperation/OSTNOSGM15Grid.php | 39 +- src/EPSG/Import/EPSGCodegenFromDataImport.php | 14 +- src/GeographicPoint.php | 179 +----- src/VerticalPoint.php | 19 +- tests/CompoundPointTest.php | 8 +- tests/GeographicPoint3DTest.php | 16 +- tests/GeographicPointTest.php | 40 +- tests/VerticalPointTest.php | 10 +- 29 files changed, 589 insertions(+), 1044 deletions(-) create mode 100644 src/CoordinateOperation/GeographicGeoidHeightGrid.php create mode 100644 src/CoordinateOperation/GeographicGrid.php create mode 100644 src/CoordinateOperation/Grid.php create mode 100644 src/CoordinateOperation/NADCON5Grids.php diff --git a/docs/coordinate_conversions_hard_compound.rst b/docs/coordinate_conversions_hard_compound.rst index 1c8260190..fa3b8df22 100644 --- a/docs/coordinate_conversions_hard_compound.rst +++ b/docs/coordinate_conversions_hard_compound.rst @@ -14,15 +14,16 @@ Geographic2D with Height Offsets Length $geoidUndulation ); // returns a new GeographicPoint -Geographic3D to Geographic2D+GravityRelatedHeight (GTX) -------------------------------------------------------- +Geographic3D to Geographic2D+GravityRelatedHeight From Grid (geographic) +------------------------------------------------------------------------ +The following grid file types are supported: ``.gtx`` (``GTXGrid``), ``.mnt/.tac`` from IGN France (``IGNFHeightGrid``) and ``.txt`` from IGN Spain (``IGNESHeightGrid``) .. code-block:: php $point = CompoundPoint::create(...); - $newPoint = $point->geographic3DTo2DPlusGravityHeightGTX( + $newPoint = $point->geographic3DTo2DPlusGravityHeightFromGrid( Geographic3D $to, - GTXGrid $geoidHeightCorrectionModelFile + GeographicGeoidHeightGrid $geoidHeightCorrectionModelFile ); // returns a new GeographicPoint Geographic3D to Geographic2D+GravityRelatedHeight (OSGM-GB) @@ -33,6 +34,5 @@ Geographic3D to Geographic2D+GravityRelatedHeight (OSGM-GB) $point = CompoundPoint::create(...); $newPoint = $point->geographic3DTo2DPlusGravityHeightOSGM15( Geographic3D $to, - OSTNOSGM15Grid $geoidHeightCorrectionModelFile, - string $EPSGCodeForInterpolationCRS + OSTNOSGM15Grid $geoidHeightCorrectionModelFile ); // returns a new GeographicPoint diff --git a/docs/coordinate_conversions_hard_geographic.rst b/docs/coordinate_conversions_hard_geographic.rst index ed6317100..36afa4499 100644 --- a/docs/coordinate_conversions_hard_geographic.rst +++ b/docs/coordinate_conversions_hard_geographic.rst @@ -189,20 +189,6 @@ Geocentric translation Length $zAxisTranslation ); // returns a new GeographicPoint -Geocentric translation by grid interpolation (IGNF) ---------------------------------------------------- - -.. code-block:: php - - $point = GeographicPoint::create(...); - $newPoint = $point->geocentricTranslationByGridInterpolationIGNF( - Geographic $to, - IGNFGeocentricTranslationGrid $geocentricTranslationFile, - string $EPSGCodeForInterpolationCRS, - string $EPSGCodeForStandardCT, - bool $inReverse - ); // returns a new GeographicPoint - Geographic <=> geocentric conversion ------------------------------------ @@ -238,15 +224,16 @@ Geographic2D with Height Offsets Length $geoidUndulation ); // returns a new CompoundPoint -Geographic3D to Geographic2D+GravityRelatedHeight (GTX) +Geographic3D to Geographic2D+GravityRelatedHeight From Grid ----------------------------------------------------------- +The following grid file types are supported: ``.gtx`` (``GTXGrid``), ``.mnt/.tac`` from IGN France (``IGNFHeightGrid``) and ``.txt`` from IGN Spain (``IGNESHeightGrid``) .. code-block:: php $point = GeographicPoint::create(...); - $newPoint = $point->geographic3DTo2DPlusGravityHeightGTX( + $newPoint = $point->geographic3DTo2DPlusGravityHeightFromGrid( Compound $to, - GTXGrid $geoidHeightCorrectionModelFile + GeographicGeoidHeightGrid $geoidHeightCorrectionModelFile ); // returns a new CompoundPoint Geographic3D to Geographic2D+GravityRelatedHeight (OSGM-GB) @@ -257,19 +244,19 @@ Geographic3D to Geographic2D+GravityRelatedHeight (OSGM-GB) $point = GeographicPoint::create(...); $newPoint = $point->geographic3DTo2DPlusGravityHeightOSGM15( Compound $to, - OSTNOSGM15Grid $geoidHeightCorrectionModelFile, - string $EPSGCodeForInterpolationCRS + OSTNOSGM15Grid $geoidHeightCorrectionModelFile ); // returns a new CompoundPoint -Geographic3D to GravityRelatedHeight (GTX) +Geographic3D to GravityRelatedHeight From Grid ---------------------------------------------- +The following grid file types are supported: ``.gtx`` (``GTXGrid``), ``.mnt/.tac`` from IGN France (``IGNFHeightGrid``) and ``.txt`` from IGN Spain (``IGNESHeightGrid``) .. code-block:: php $point = GeographicPoint::create(...); - $newPoint = $point->geographic3DToGravityHeightGTX( + $newPoint = $point->geographic3DTo2DPlusGravityHeightFromGrid(( Vertical $to, - GTXGrid $geoidHeightCorrectionModelFile + GeographicGeoidHeightGrid $geoidHeightCorrectionModelFile ); // returns a new VerticalPoint Geographic3D to GravityRelatedHeight (OSGM-GB) @@ -687,20 +674,6 @@ Molodensky-Badekas Position Vector transformation Length $ordinate3OfEvaluationPoint ); // returns a new GeographicPoint -NADCON5 -------- - -.. code-block:: php - - $point = GeographicPoint::create(...); - $newPoint = $point->NADCON5( - Geographic $to, - NADCON5Grid $latitudeDifferenceFile, - NADCON5Grid $longitudeDifferenceFile, - ?NADCON5Grid $ellipsoidalHeightDifferenceFile, - bool $inReverse - ); // returns a new GeographicPoint - New Zealand Map Grid -------------------- @@ -715,18 +688,6 @@ New Zealand Map Grid Length $falseNorthing ); // returns a new ProjectedPoint -NTv2 ----- - -.. code-block:: php - - $point = GeographicPoint::create(...); - $newPoint = $point->NTv2( - Geographic $to, - NTv2Grid $latitudeAndLongitudeDifferenceFile, - bool $inReverse - ); // returns a new GeographicPoint - Oblique Stereographic --------------------- @@ -742,6 +703,19 @@ Oblique Stereographic Length $falseNorthing ); // returns a new ProjectedPoint +Offsets From Grid +----------------- +The following grid file types are supported: ``.gsb`` (``NTv2Grid``), ``.txt/.mnt/.tac`` from IGN France (``IGNFGeocentricTranslationGrid``) and ``.b`` from NOAA (``NADCON5Grids``) + +.. code-block:: php + + $point = GeographicPoint::create(...); + $newPoint = $point->offsetsFromGrid( + Geographic $to, + GeographicGrid $offsetsFile, + bool $inReverse + ); // returns a new GeographicPoint + OSTN15 (Ordnance Survey National Transformation) ------------------------------------------------ diff --git a/docs/coordinate_conversions_hard_vertical.rst b/docs/coordinate_conversions_hard_vertical.rst index 0fd0bba23..8641ba457 100644 --- a/docs/coordinate_conversions_hard_vertical.rst +++ b/docs/coordinate_conversions_hard_vertical.rst @@ -11,24 +11,24 @@ Height <=> Depth reversal Vertical $to ); // returns a new VerticalPoint -Vertical Offset ---------------- +Offset +------ .. code-block:: php $point = VerticalPoint::create(...); - $newPoint = $point->verticalOffset( + $newPoint = $point->offset( Vertical $to, Length $verticalOffset ); // returns a new VerticalPoint -Vertical Offset and Slope -------------------------- +Offset and Slope +---------------- .. code-block:: php $point = VerticalPoint::create(...); - $newPoint = $point->verticalOffsetAndSlope( + $newPoint = $point->offsetAndSlope( Vertical $to, Angle $ordinate1OfEvaluationPoint, Angle $ordinate2OfEvaluationPoint, @@ -38,15 +38,17 @@ Vertical Offset and Slope GeographicPoint $horizontalPoint ); // returns a new VerticalPoint -Vertical Offset by Grid Interpolation (GTX) -------------------------------------------- +Offset From Grid File +--------------------- + +The following grid file types are supported: ``.gtx`` (``GTXGrid``), ``.mnt/.tac`` from IGN France (``IGNFHeightGrid``) and ``.txt`` from IGN Spain (``IGNESHeightGrid``) .. code-block:: php $point = VerticalPoint::create(...); - $newPoint = $point->verticalOffsetGTX( + $newPoint = $point->offsetFromGrid( Vertical $to, - GTXGrid $verticalOffsetFile, + GeographicGeoidHeightGrid $offsetsFile, bool $inReverse, GeographicPoint $horizontalPoint ); // returns a new VerticalPoint diff --git a/src/CompoundPoint.php b/src/CompoundPoint.php index 05e836e02..c6644af66 100644 --- a/src/CompoundPoint.php +++ b/src/CompoundPoint.php @@ -13,9 +13,7 @@ use DateTimeInterface; use PHPCoord\CoordinateOperation\AutoConversion; use PHPCoord\CoordinateOperation\ConvertiblePoint; -use PHPCoord\CoordinateOperation\GTXGrid; -use PHPCoord\CoordinateOperation\IGNESHeightGrid; -use PHPCoord\CoordinateOperation\IGNFHeightGrid; +use PHPCoord\CoordinateOperation\GeographicGeoidHeightGrid; use PHPCoord\CoordinateOperation\OSTNOSGM15Grid; use PHPCoord\CoordinateReferenceSystem\Compound; use PHPCoord\CoordinateReferenceSystem\CoordinateReferenceSystem; @@ -190,8 +188,7 @@ public function geographic2DWithHeightOffsets( */ public function geographic3DTo2DPlusGravityHeightOSGM15( Geographic3D $to, - OSTNOSGM15Grid $geoidHeightCorrectionModelFile, - string $EPSGCodeForInterpolationCRS + OSTNOSGM15Grid $geoidHeightCorrectionModelFile ): GeographicPoint { $osgb36NationalGrid = Projected::fromSRID(Projected::EPSG_OSGB36_BRITISH_NATIONAL_GRID); $etrs89NationalGrid = new Projected( @@ -206,58 +203,23 @@ public function geographic3DTo2DPlusGravityHeightOSGM15( return GeographicPoint::create( $this->horizontalPoint->getLatitude(), $this->horizontalPoint->getLongitude(), - $this->verticalPoint->getHeight()->add($geoidHeightCorrectionModelFile->getVerticalAdjustment($projected)), + $this->verticalPoint->getHeight()->add($geoidHeightCorrectionModelFile->getHeightAdjustment($projected)), $to, $this->getCoordinateEpoch() ); } /** - * Geog3D to Geog2D+GravityRelatedHeight (gtx). + * Geog3D to Geog2D+GravityRelatedHeight. */ - public function geographic3DTo2DPlusGravityHeightGTX( + public function geographic3DTo2DPlusGravityHeightFromGrid( Geographic3D $to, - GTXGrid $geoidHeightCorrectionModelFile, - string $EPSGCodeForInterpolationCRS + GeographicGeoidHeightGrid $geoidHeightCorrectionModelFile ): GeographicPoint { return GeographicPoint::create( $this->horizontalPoint->getLatitude(), $this->horizontalPoint->getLongitude(), - $this->verticalPoint->getHeight()->add($geoidHeightCorrectionModelFile->getAdjustment($this->horizontalPoint)), - $to, - $this->getCoordinateEpoch() - ); - } - - /** - * Geog3D to Geog2D+GravityRelatedHeight (IGNES). - */ - public function geographic3DTo2DPlusGravityHeightIGNES( - Geographic3D $to, - IGNESHeightGrid $geoidHeightCorrectionModelFile, - string $EPSGCodeForInterpolationCRS - ): GeographicPoint { - return GeographicPoint::create( - $this->horizontalPoint->getLatitude(), - $this->horizontalPoint->getLongitude(), - $this->verticalPoint->getHeight()->add($geoidHeightCorrectionModelFile->getAdjustment($this->horizontalPoint)), - $to, - $this->getCoordinateEpoch() - ); - } - - /** - * Geog3D to Geog2D+GravityRelatedHeight (IGNF). - */ - public function geographic3DTo2DPlusGravityHeightIGNF( - Geographic3D $to, - IGNFHeightGrid $geoidHeightCorrectionModelFile, - string $EPSGCodeForInterpolationCRS - ): GeographicPoint { - return GeographicPoint::create( - $this->horizontalPoint->getLatitude(), - $this->horizontalPoint->getLongitude(), - $this->verticalPoint->getHeight()->add($geoidHeightCorrectionModelFile->getAdjustment($this->horizontalPoint)), + $this->verticalPoint->getHeight()->add($geoidHeightCorrectionModelFile->getHeightAdjustment($this->horizontalPoint)), $to, $this->getCoordinateEpoch() ); diff --git a/src/CoordinateOperation/BilinearInterpolation.php b/src/CoordinateOperation/BilinearInterpolation.php index 4019fc772..dcbff3396 100644 --- a/src/CoordinateOperation/BilinearInterpolation.php +++ b/src/CoordinateOperation/BilinearInterpolation.php @@ -23,14 +23,14 @@ trait BilinearInterpolation protected float $columnGridInterval; protected float $rowGridInterval; - public function interpolateBilinear( + public function interpolate( float $x, float $y ): array { - $corners = $this->getCornersForBilinear($x, $y); + $corners = $this->getCorners($x, $y); - $dx = $corners['lowerRight']->getX() === $corners['lowerLeft']->getX() ? 0 : (($x - $corners['lowerLeft']->getX()) / ($corners['lowerRight']->getX() - $corners['lowerLeft']->getX())); - $dy = $corners['upperLeft']->getY() === $corners['lowerLeft']->getY() ? 0 : (($y - $corners['lowerLeft']->getY()) / ($corners['upperLeft']->getY() - $corners['lowerLeft']->getY())); + $dx = $corners['lowerRight']->getX() === $corners['lowerLeft']->getX() ? 0 : (($x - $corners['lowerLeft']->getX()) / $this->columnGridInterval); + $dy = $corners['upperLeft']->getY() === $corners['lowerLeft']->getY() ? 0 : (($y - $corners['lowerLeft']->getY()) / $this->rowGridInterval); $interpolations = []; for ($i = 0, $count = count($corners['lowerLeft']->getValues()); $i < $count; ++$i) { @@ -59,7 +59,7 @@ private function interpolateLinear(float $p, float $valueAt0, float $valueAt1): /** * @return GridValues[] */ - private function getCornersForBilinear(float $x, float $y): array + private function getCorners(float $x, float $y): array { $xIndex = (int) (($x - $this->startX) / $this->columnGridInterval); $yIndex = (int) (($y - $this->startY) / $this->rowGridInterval); diff --git a/src/CoordinateOperation/BiquadraticInterpolation.php b/src/CoordinateOperation/BiquadraticInterpolation.php index 7da1526cd..5766fe41f 100644 --- a/src/CoordinateOperation/BiquadraticInterpolation.php +++ b/src/CoordinateOperation/BiquadraticInterpolation.php @@ -9,6 +9,9 @@ namespace PHPCoord\CoordinateOperation; use function assert; +use function count; +use function max; +use function min; trait BiquadraticInterpolation { @@ -21,6 +24,32 @@ trait BiquadraticInterpolation protected float $columnGridInterval; protected float $rowGridInterval; + public function interpolate( + float $x, + float $y + ): array { + $corners = $this->getCorners($x, $y); + + $dx = $corners['lowerRight']->getX() === $corners['lowerLeft']->getX() ? 0 : (($x - $corners['lowerLeft']->getX()) / $this->columnGridInterval); + $dy = $corners['upperLeft']->getY() === $corners['lowerLeft']->getY() ? 0 : (($y - $corners['lowerLeft']->getY()) / $this->rowGridInterval); + + $interpolations = []; + for ($i = 0, $count = count($corners['lowerLeft']->getValues()); $i < $count; ++$i) { + //Interpolate value at lower row + $y0 = $this->interpolateQuadratic($dx, $corners['lowerLeft']->getValues()[$i], $corners['lowerCentre']->getValues()[$i], $corners['lowerRight']->getValues()[$i]); + //Interpolate value at middle row + $y1 = $this->interpolateQuadratic($dx, $corners['middleLeft']->getValues()[$i], $corners['middleCentre']->getValues()[$i], $corners['middleRight']->getValues()[$i]); + //Interpolate value at upper row + $y2 = $this->interpolateQuadratic($dx, $corners['upperLeft']->getValues()[$i], $corners['upperCentre']->getValues()[$i], $corners['upperRight']->getValues()[$i]); + + //Interpolate between rows + $xy = $this->interpolateQuadratic($dy, $y0, $y1, $y2); + $interpolations[] = $xy; + } + + return $interpolations; + } + /** * Quadratic interpolation at point p, where p is between 0 and 2. * Converted from NOAA FORTRAN implementation, this function apparently uses Newton-Gregory forward polynomial. @@ -35,4 +64,39 @@ private function interpolateQuadratic(float $p, float $valueAt0, float $valueAt1 return $valueAt0 + $p * $difference1 + $p / 2 * ($p - 1) * $differenceDifferences; } + + /** + * @return GridValues[] + */ + private function getCorners(float $x, float $y): array + { + // Method: + // Fit a 3x3 window over the random point. The closest + // 2x2 points will surround the point. But based on which + // quadrant of that 2x2 cell in which the point falls, the + // 3x3 window could extend NW, NE, SW or SE from the 2x2 cell. + + // Find which column should be LEAST when fitting + // a 3x3 window around $longitude. + $xIndex = (int) (($x - $this->startX) / $this->columnGridInterval - 0.5); + + // Find which row should be LEAST when fitting + // a 3x3 window around $latitude. + $yIndex = (int) (($y - $this->startY) / $this->rowGridInterval - 0.5); + + $xIndex = min(max($xIndex, 0), $this->numberOfColumns - 3); + $yIndex = min(max($yIndex, 0), $this->numberOfRows - 3); + + return [ + 'lowerLeft' => $this->getRecord($xIndex, $yIndex), + 'lowerCentre' => $this->getRecord($xIndex + 1, $yIndex), + 'lowerRight' => $this->getRecord($xIndex + 2, $yIndex), + 'middleLeft' => $this->getRecord($xIndex, $yIndex + 1), + 'middleCentre' => $this->getRecord($xIndex + 1, $yIndex + 1), + 'middleRight' => $this->getRecord($xIndex + 2, $yIndex + 1), + 'upperLeft' => $this->getRecord($xIndex, $yIndex + 2), + 'upperCentre' => $this->getRecord($xIndex + 1, $yIndex + 2), + 'upperRight' => $this->getRecord($xIndex + 2, $yIndex + 2), + ]; + } } diff --git a/src/CoordinateOperation/CoordinateOperationMethods.php b/src/CoordinateOperation/CoordinateOperationMethods.php index e9f7a06c6..2a9086ceb 100644 --- a/src/CoordinateOperation/CoordinateOperationMethods.php +++ b/src/CoordinateOperation/CoordinateOperationMethods.php @@ -844,8 +844,8 @@ class CoordinateOperationMethods self::EPSG_TRANSVERSE_MERCATOR => 'transverseMercator', self::EPSG_TRANSVERSE_MERCATOR_SOUTH_ORIENTATED => 'transverseMercator', self::EPSG_TRANSVERSE_MERCATOR_ZONED_GRID_SYSTEM => 'transverseMercatorZonedGrid', - self::EPSG_VERTICAL_OFFSET => 'verticalOffset', - self::EPSG_VERTICAL_OFFSET_AND_SLOPE => 'verticalOffsetAndSlope', + self::EPSG_VERTICAL_OFFSET => 'offset', + self::EPSG_VERTICAL_OFFSET_AND_SLOPE => 'offsetAndSlope', self::EPSG_GENERAL_POLYNOMIAL_OF_DEGREE_2 => 'generalPolynomial', self::EPSG_GENERAL_POLYNOMIAL_OF_DEGREE_6 => 'generalPolynomial', self::EPSG_REVERSIBLE_POLYNOMIAL_OF_DEGREE_4 => 'reversiblePolynomial', @@ -862,18 +862,18 @@ class CoordinateOperationMethods self::EPSG_ORDNANCE_SURVEY_NATIONAL_TRANSFORMATION => 'OSTN15', self::EPSG_GEOG3D_TO_GEOG2D_PLUS_GRAVITYRELATEDHEIGHT_OSGM_GB => 'geographic3DTo2DPlusGravityHeightOSGM15', self::EPSG_GEOGRAPHIC3D_TO_GRAVITYRELATEDHEIGHT_OSGM_GB => 'geographic3DToGravityHeightOSGM15', - self::EPSG_NADCON5_2D => 'NADCON5', - self::EPSG_NADCON5_3D => 'NADCON5', - self::EPSG_NTV2 => 'NTv2', + self::EPSG_NADCON5_2D => 'offsetsFromGridNADCON5', + self::EPSG_NADCON5_3D => 'offsetsFromGridNADCON5', + self::EPSG_NTV2 => 'offsetsFromGrid', self::EPSG_ZERO_TIDE_HEIGHT_TO_MEAN_TIDE_HEIGHT_EVRF2019 => 'zeroTideHeightToMeanTideHeightEVRF2019', - self::EPSG_GEOCENTRIC_TRANSLATION_BY_GRID_INTERPOLATION_IGN => 'geocentricTranslationByGridInterpolationIGNF', - self::EPSG_GEOG3D_TO_GEOG2D_PLUS_GRAVITYRELATEDHEIGHT_GTX => 'geographic3DTo2DPlusGravityHeightGTX', - self::EPSG_GEOGRAPHIC3D_TO_GRAVITYRELATEDHEIGHT_GTX => 'geographic3DToGravityHeightGTX', - self::EPSG_VERTICAL_OFFSET_BY_GRID_INTERPOLATION_GTX => 'verticalOffsetGTX', - self::EPSG_GEOG3D_TO_GEOG2D_PLUS_GRAVITYRELATEDHEIGHT_IGN2009 => 'geographic3DTo2DPlusGravityHeightIGNF', - self::EPSG_GEOGRAPHIC3D_TO_GRAVITYRELATEDHEIGHT_IGN2009 => 'geographic3DToGravityHeightIGNF', - self::EPSG_GEOG3D_TO_GEOG2D_PLUS_GRAVITYRELATEDHEIGHT_EGM2008 => 'geographic3DTo2DPlusGravityHeightIGNES', - self::EPSG_GEOGRAPHIC3D_TO_GRAVITYRELATEDHEIGHT_EGM2008 => 'geographic3DToGravityHeightIGNES', + self::EPSG_GEOCENTRIC_TRANSLATION_BY_GRID_INTERPOLATION_IGN => 'offsetsFromGrid', + self::EPSG_GEOG3D_TO_GEOG2D_PLUS_GRAVITYRELATEDHEIGHT_GTX => 'geographic3DTo2DPlusGravityHeightFromGrid', + self::EPSG_GEOGRAPHIC3D_TO_GRAVITYRELATEDHEIGHT_GTX => 'geographic3DToGravityHeightFromGrid', + self::EPSG_VERTICAL_OFFSET_BY_GRID_INTERPOLATION_GTX => 'offsetFromGrid', + self::EPSG_GEOG3D_TO_GEOG2D_PLUS_GRAVITYRELATEDHEIGHT_IGN2009 => 'geographic3DTo2DPlusGravityHeightFromGrid', + self::EPSG_GEOGRAPHIC3D_TO_GRAVITYRELATEDHEIGHT_IGN2009 => 'geographic3DToGravityHeightFromGrid', + self::EPSG_GEOG3D_TO_GEOG2D_PLUS_GRAVITYRELATEDHEIGHT_EGM2008 => 'geographic3DTo2DPlusGravityHeightFromGrid', + self::EPSG_GEOGRAPHIC3D_TO_GRAVITYRELATEDHEIGHT_EGM2008 => 'geographic3DToGravityHeightFromGrid', ]; public static function getFunctionName(string $srid): string diff --git a/src/CoordinateOperation/CoordinateOperationParams.php b/src/CoordinateOperation/CoordinateOperationParams.php index 53d4ec2bb..ebf8bf81b 100644 --- a/src/CoordinateOperation/CoordinateOperationParams.php +++ b/src/CoordinateOperation/CoordinateOperationParams.php @@ -5405,7 +5405,7 @@ class CoordinateOperationParams ], ], 'urn:ogc:def:coordinateOperation:EPSG::1313' => [ - 'latitudeAndLongitudeDifferenceFile' => [ + 'offsetsFile' => [ 'reverses' => true, 'fileProvider' => 'PHPCoord\\CoordinateOperation\\NTv2NAD27NAD83CanadaProvider', ], @@ -6304,7 +6304,7 @@ class CoordinateOperationParams ], ], 'urn:ogc:def:coordinateOperation:EPSG::1463' => [ - 'latitudeAndLongitudeDifferenceFile' => [ + 'offsetsFile' => [ 'reverses' => true, 'fileProvider' => 'PHPCoord\\CoordinateOperation\\NTv2NAD27MAY76NAD831986OntarioProvider', ], @@ -7118,7 +7118,7 @@ class CoordinateOperationParams ], ], 'urn:ogc:def:coordinateOperation:EPSG::1568' => [ - 'latitudeAndLongitudeDifferenceFile' => [ + 'offsetsFile' => [ 'reverses' => true, 'fileProvider' => 'PHPCoord\\CoordinateOperation\\NTv2NZGD1949NZGD2000NewZealandProvider', ], @@ -7158,13 +7158,13 @@ class CoordinateOperationParams ], ], 'urn:ogc:def:coordinateOperation:EPSG::1573' => [ - 'latitudeAndLongitudeDifferenceFile' => [ + 'offsetsFile' => [ 'reverses' => true, 'fileProvider' => 'PHPCoord\\CoordinateOperation\\NTv2NAD27NAD831986QuebecProvider', ], ], 'urn:ogc:def:coordinateOperation:EPSG::1575' => [ - 'latitudeAndLongitudeDifferenceFile' => [ + 'offsetsFile' => [ 'reverses' => true, 'fileProvider' => 'PHPCoord\\CoordinateOperation\\NTv2NAD27CGQ77NAD831986QuebecProvider', ], @@ -9246,7 +9246,7 @@ class CoordinateOperationParams ], ], 'urn:ogc:def:coordinateOperation:EPSG::1670' => [ - 'latitudeAndLongitudeDifferenceFile' => [ + 'offsetsFile' => [ 'reverses' => true, 'fileProvider' => 'PHPCoord\\CoordinateOperation\\NTv2NZGD1949NZGD2000NewZealandProvider', ], @@ -9690,49 +9690,49 @@ class CoordinateOperationParams ], ], 'urn:ogc:def:coordinateOperation:EPSG::1688' => [ - 'latitudeAndLongitudeDifferenceFile' => [ + 'offsetsFile' => [ 'reverses' => true, 'fileProvider' => 'PHPCoord\\CoordinateOperation\\NTv2ATS77NAD83CSRS1997NewBrunswickProvider', ], ], 'urn:ogc:def:coordinateOperation:EPSG::1689' => [ - 'latitudeAndLongitudeDifferenceFile' => [ + 'offsetsFile' => [ 'reverses' => true, 'fileProvider' => 'PHPCoord\\CoordinateOperation\\NTv2ATS777NAD83CSRS1997PrinceEdwardProvider', ], ], 'urn:ogc:def:coordinateOperation:EPSG::1690' => [ - 'latitudeAndLongitudeDifferenceFile' => [ + 'offsetsFile' => [ 'reverses' => true, 'fileProvider' => 'PHPCoord\\CoordinateOperation\\NTv2NAD27MAY76NAD831986OntarioProvider', ], ], 'urn:ogc:def:coordinateOperation:EPSG::1691' => [ - 'latitudeAndLongitudeDifferenceFile' => [ + 'offsetsFile' => [ 'reverses' => true, 'fileProvider' => 'PHPCoord\\CoordinateOperation\\NTv2NAD27CGQ77NAD831986QuebecProvider', ], ], 'urn:ogc:def:coordinateOperation:EPSG::1692' => [ - 'latitudeAndLongitudeDifferenceFile' => [ + 'offsetsFile' => [ 'reverses' => true, 'fileProvider' => 'PHPCoord\\CoordinateOperation\\NTv2NAD27NAD83CSRS1997QuebecProvider', ], ], 'urn:ogc:def:coordinateOperation:EPSG::1693' => [ - 'latitudeAndLongitudeDifferenceFile' => [ + 'offsetsFile' => [ 'reverses' => true, 'fileProvider' => 'PHPCoord\\CoordinateOperation\\NTv2NAD27NAD83CanadaProvider', ], ], 'urn:ogc:def:coordinateOperation:EPSG::1696' => [ - 'latitudeAndLongitudeDifferenceFile' => [ + 'offsetsFile' => [ 'reverses' => true, 'fileProvider' => 'PHPCoord\\CoordinateOperation\\NTv2NAD831986NAD83CSRS1997QuebecProvider', ], ], 'urn:ogc:def:coordinateOperation:EPSG::1697' => [ - 'latitudeAndLongitudeDifferenceFile' => [ + 'offsetsFile' => [ 'reverses' => true, 'fileProvider' => 'PHPCoord\\CoordinateOperation\\NTv2NAD831986NAD83CSRS1997SaskatchewanProvider', ], @@ -9775,13 +9775,13 @@ class CoordinateOperationParams ], ], 'urn:ogc:def:coordinateOperation:EPSG::1702' => [ - 'latitudeAndLongitudeDifferenceFile' => [ + 'offsetsFile' => [ 'reverses' => true, 'fileProvider' => 'PHPCoord\\CoordinateOperation\\NTv2NAD831986NAD83CSRS2002AlbertaProvider', ], ], 'urn:ogc:def:coordinateOperation:EPSG::1703' => [ - 'latitudeAndLongitudeDifferenceFile' => [ + 'offsetsFile' => [ 'reverses' => true, 'fileProvider' => 'PHPCoord\\CoordinateOperation\\NTv2NAD27NAD83CSRS1997SaskatchewanProvider', ], @@ -10645,13 +10645,13 @@ class CoordinateOperationParams ], ], 'urn:ogc:def:coordinateOperation:EPSG::1803' => [ - 'latitudeAndLongitudeDifferenceFile' => [ + 'offsetsFile' => [ 'reverses' => true, 'fileProvider' => 'PHPCoord\\CoordinateOperation\\NTv2AGD66GDA94AustraliaProvider', ], ], 'urn:ogc:def:coordinateOperation:EPSG::1804' => [ - 'latitudeAndLongitudeDifferenceFile' => [ + 'offsetsFile' => [ 'reverses' => true, 'fileProvider' => 'PHPCoord\\CoordinateOperation\\NTv2AGD84GDA94AustraliaProvider', ], @@ -24087,49 +24087,49 @@ class CoordinateOperationParams ], ], 'urn:ogc:def:coordinateOperation:EPSG::5525' => [ - 'latitudeAndLongitudeDifferenceFile' => [ + 'offsetsFile' => [ 'reverses' => true, 'fileProvider' => 'PHPCoord\\CoordinateOperation\\NTv2CA61SIRGAS2000BrazilProvider', ], ], 'urn:ogc:def:coordinateOperation:EPSG::5526' => [ - 'latitudeAndLongitudeDifferenceFile' => [ + 'offsetsFile' => [ 'reverses' => true, 'fileProvider' => 'PHPCoord\\CoordinateOperation\\NTv2CA7072SIRGAS2000BrazilProvider', ], ], 'urn:ogc:def:coordinateOperation:EPSG::5528' => [ - 'latitudeAndLongitudeDifferenceFile' => [ + 'offsetsFile' => [ 'reverses' => true, 'fileProvider' => 'PHPCoord\\CoordinateOperation\\NTv2SAD69SIRGAS2000BrazilProvider', ], ], 'urn:ogc:def:coordinateOperation:EPSG::5529' => [ - 'latitudeAndLongitudeDifferenceFile' => [ + 'offsetsFile' => [ 'reverses' => true, 'fileProvider' => 'PHPCoord\\CoordinateOperation\\NTv2SAD6996SIRGAS2000BrazilProvider', ], ], 'urn:ogc:def:coordinateOperation:EPSG::5540' => [ - 'latitudeAndLongitudeDifferenceFile' => [ + 'offsetsFile' => [ 'reverses' => true, 'fileProvider' => 'PHPCoord\\CoordinateOperation\\NTv2CA61SIRGAS2000BrazilProvider', ], ], 'urn:ogc:def:coordinateOperation:EPSG::5541' => [ - 'latitudeAndLongitudeDifferenceFile' => [ + 'offsetsFile' => [ 'reverses' => true, 'fileProvider' => 'PHPCoord\\CoordinateOperation\\NTv2CA7072SIRGAS2000BrazilProvider', ], ], 'urn:ogc:def:coordinateOperation:EPSG::5542' => [ - 'latitudeAndLongitudeDifferenceFile' => [ + 'offsetsFile' => [ 'reverses' => true, 'fileProvider' => 'PHPCoord\\CoordinateOperation\\NTv2SAD69SIRGAS2000BrazilProvider', ], ], 'urn:ogc:def:coordinateOperation:EPSG::5543' => [ - 'latitudeAndLongitudeDifferenceFile' => [ + 'offsetsFile' => [ 'reverses' => true, 'fileProvider' => 'PHPCoord\\CoordinateOperation\\NTv2SAD6996SIRGAS2000BrazilProvider', ], @@ -24669,7 +24669,7 @@ class CoordinateOperationParams ], ], 'urn:ogc:def:coordinateOperation:EPSG::5661' => [ - 'latitudeAndLongitudeDifferenceFile' => [ + 'offsetsFile' => [ 'reverses' => true, 'fileProvider' => 'PHPCoord\\CoordinateOperation\\NTv2ED50ETRS89CataloniaProvider', ], @@ -24962,7 +24962,7 @@ class CoordinateOperationParams ], ], 'urn:ogc:def:coordinateOperation:EPSG::5891' => [ - 'latitudeAndLongitudeDifferenceFile' => [ + 'offsetsFile' => [ 'reverses' => true, 'fileProvider' => 'PHPCoord\\CoordinateOperation\\NTv2MGIETRS89AustriaProvider', ], @@ -28360,13 +28360,13 @@ class CoordinateOperationParams ], ], 'urn:ogc:def:coordinateOperation:EPSG::6188' => [ - 'latitudeAndLongitudeDifferenceFile' => [ + 'offsetsFile' => [ 'reverses' => true, 'fileProvider' => 'PHPCoord\\CoordinateOperation\\NTv2LisbonETRS89PortugalProvider', ], ], 'urn:ogc:def:coordinateOperation:EPSG::6189' => [ - 'latitudeAndLongitudeDifferenceFile' => [ + 'offsetsFile' => [ 'reverses' => true, 'fileProvider' => 'PHPCoord\\CoordinateOperation\\NTv273ETRS89PortugalProvider', ], @@ -32401,13 +32401,13 @@ class CoordinateOperationParams ], ], 'urn:ogc:def:coordinateOperation:EPSG::6712' => [ - 'latitudeAndLongitudeDifferenceFile' => [ + 'offsetsFile' => [ 'reverses' => true, 'fileProvider' => 'PHPCoord\\CoordinateOperation\\NTv2TokyoJGD2000JapanProvider', ], ], 'urn:ogc:def:coordinateOperation:EPSG::6713' => [ - 'latitudeAndLongitudeDifferenceFile' => [ + 'offsetsFile' => [ 'reverses' => true, 'fileProvider' => 'PHPCoord\\CoordinateOperation\\NTv2JGD2000JGD2011JapanProvider', ], @@ -32602,7 +32602,7 @@ class CoordinateOperationParams ], ], 'urn:ogc:def:coordinateOperation:EPSG::6740' => [ - 'latitudeAndLongitudeDifferenceFile' => [ + 'offsetsFile' => [ 'reverses' => true, 'fileProvider' => 'PHPCoord\\CoordinateOperation\\NTv2TokyoJGD2000JapanProvider', ], @@ -34986,7 +34986,7 @@ class CoordinateOperationParams ], ], 'urn:ogc:def:coordinateOperation:EPSG::6948' => [ - 'latitudeAndLongitudeDifferenceFile' => [ + 'offsetsFile' => [ 'reverses' => true, 'fileProvider' => 'PHPCoord\\CoordinateOperation\\NTv2RD83ETRS89SaxonyProvider', ], @@ -43554,13 +43554,13 @@ class CoordinateOperationParams ], ], 'urn:ogc:def:coordinateOperation:EPSG::7673' => [ - 'latitudeAndLongitudeDifferenceFile' => [ + 'offsetsFile' => [ 'reverses' => true, 'fileProvider' => 'PHPCoord\\CoordinateOperation\\NTv2LV03ETRS89SwitzerlandProvider', ], ], 'urn:ogc:def:coordinateOperation:EPSG::7674' => [ - 'latitudeAndLongitudeDifferenceFile' => [ + 'offsetsFile' => [ 'reverses' => true, 'fileProvider' => 'PHPCoord\\CoordinateOperation\\NTv2LV03ETRS89SwitzerlandProvider', ], @@ -45176,7 +45176,7 @@ class CoordinateOperationParams ], ], 'urn:ogc:def:coordinateOperation:EPSG::7788' => [ - 'latitudeAndLongitudeDifferenceFile' => [ + 'offsetsFile' => [ 'reverses' => true, 'fileProvider' => 'PHPCoord\\CoordinateOperation\\NTv2LV03ETRS89SwitzerlandProvider', ], @@ -47835,19 +47835,19 @@ class CoordinateOperationParams ], ], 'urn:ogc:def:coordinateOperation:EPSG::7969' => [ - 'verticalOffsetFile' => [ + 'offsetsFile' => [ 'reverses' => true, 'fileProvider' => 'PHPCoord\\CoordinateOperation\\GTXNGVD29NAVD88CONUSWestProvider', ], ], 'urn:ogc:def:coordinateOperation:EPSG::7970' => [ - 'verticalOffsetFile' => [ + 'offsetsFile' => [ 'reverses' => true, 'fileProvider' => 'PHPCoord\\CoordinateOperation\\GTXNGVD29NAVD88CONUSCentralProvider', ], ], 'urn:ogc:def:coordinateOperation:EPSG::7971' => [ - 'verticalOffsetFile' => [ + 'offsetsFile' => [ 'reverses' => true, 'fileProvider' => 'PHPCoord\\CoordinateOperation\\GTXNGVD29NAVD88CONUSEastProvider', ], @@ -51340,22 +51340,12 @@ class CoordinateOperationParams 'reverses' => true, 'fileProvider' => 'PHPCoord\\CoordinateOperation\\GTXETRS89Baltic1957SlovakiaProvider', ], - 'EPSGCodeForInterpolationCRS' => [ - 'value' => 'urn:ogc:def:crs:EPSG::4258', - 'uom' => null, - 'reverses' => false, - ], ], 'urn:ogc:def:coordinateOperation:EPSG::8362' => [ 'geoidHeightCorrectionModelFile' => [ 'reverses' => true, 'fileProvider' => 'PHPCoord\\CoordinateOperation\\GTXETRS89EVRF2007SlovakiaProvider', ], - 'EPSGCodeForInterpolationCRS' => [ - 'value' => 'urn:ogc:def:crs:EPSG::4258', - 'uom' => null, - 'reverses' => false, - ], ], 'urn:ogc:def:coordinateOperation:EPSG::8365' => [ 'xAxisTranslation' => [ @@ -51546,7 +51536,7 @@ class CoordinateOperationParams ], ], 'urn:ogc:def:coordinateOperation:EPSG::8369' => [ - 'latitudeAndLongitudeDifferenceFile' => [ + 'offsetsFile' => [ 'reverses' => true, 'fileProvider' => 'PHPCoord\\CoordinateOperation\\NTv2BD79ETRS89BelgiumProvider', ], @@ -52004,19 +51994,19 @@ class CoordinateOperationParams ], ], 'urn:ogc:def:coordinateOperation:EPSG::8444' => [ - 'latitudeAndLongitudeDifferenceFile' => [ + 'offsetsFile' => [ 'reverses' => true, 'fileProvider' => 'PHPCoord\\CoordinateOperation\\NTv2GDA94GDA2020ChristmasIslandProvider', ], ], 'urn:ogc:def:coordinateOperation:EPSG::8445' => [ - 'latitudeAndLongitudeDifferenceFile' => [ + 'offsetsFile' => [ 'reverses' => true, 'fileProvider' => 'PHPCoord\\CoordinateOperation\\NTv2GDA94GDA2020CocosIslandsProvider', ], ], 'urn:ogc:def:coordinateOperation:EPSG::8447' => [ - 'latitudeAndLongitudeDifferenceFile' => [ + 'offsetsFile' => [ 'reverses' => true, 'fileProvider' => 'PHPCoord\\CoordinateOperation\\NTv2GDA94GDA2020AustraliaProvider', ], @@ -57930,73 +57920,73 @@ class CoordinateOperationParams ], ], 'urn:ogc:def:coordinateOperation:EPSG::9105' => [ - 'latitudeAndLongitudeDifferenceFile' => [ + 'offsetsFile' => [ 'reverses' => true, 'fileProvider' => 'PHPCoord\\CoordinateOperation\\NTv2ATS77NAD831986NovaScotiaProvider', ], ], 'urn:ogc:def:coordinateOperation:EPSG::9106' => [ - 'latitudeAndLongitudeDifferenceFile' => [ + 'offsetsFile' => [ 'reverses' => true, 'fileProvider' => 'PHPCoord\\CoordinateOperation\\NTv2ATS77NAD83CSRS2010NovaScotiaProvider', ], ], 'urn:ogc:def:coordinateOperation:EPSG::9107' => [ - 'latitudeAndLongitudeDifferenceFile' => [ + 'offsetsFile' => [ 'reverses' => true, 'fileProvider' => 'PHPCoord\\CoordinateOperation\\NTv2NAD27NAD83CSRS1997OntarioProvider', ], ], 'urn:ogc:def:coordinateOperation:EPSG::9108' => [ - 'latitudeAndLongitudeDifferenceFile' => [ + 'offsetsFile' => [ 'reverses' => true, 'fileProvider' => 'PHPCoord\\CoordinateOperation\\NTv2NAD27NAD83CSRS1997OTorontoProvider', ], ], 'urn:ogc:def:coordinateOperation:EPSG::9109' => [ - 'latitudeAndLongitudeDifferenceFile' => [ + 'offsetsFile' => [ 'reverses' => true, 'fileProvider' => 'PHPCoord\\CoordinateOperation\\NTv2NAD27MAY76NAD83CSRS1997OntarioProvider', ], ], 'urn:ogc:def:coordinateOperation:EPSG::9110' => [ - 'latitudeAndLongitudeDifferenceFile' => [ + 'offsetsFile' => [ 'reverses' => true, 'fileProvider' => 'PHPCoord\\CoordinateOperation\\NTv2NAD831986NAD83CSRS1997OntarioProvider', ], ], 'urn:ogc:def:coordinateOperation:EPSG::9111' => [ - 'latitudeAndLongitudeDifferenceFile' => [ + 'offsetsFile' => [ 'reverses' => true, 'fileProvider' => 'PHPCoord\\CoordinateOperation\\NTv2NAD27NAD831986SaskatchewanProvider', ], ], 'urn:ogc:def:coordinateOperation:EPSG::9113' => [ - 'latitudeAndLongitudeDifferenceFile' => [ + 'offsetsFile' => [ 'reverses' => true, 'fileProvider' => 'PHPCoord\\CoordinateOperation\\NTv2NAD27NAD83CSRS1997BritishColumbiaCRDProvider', ], ], 'urn:ogc:def:coordinateOperation:EPSG::9115' => [ - 'latitudeAndLongitudeDifferenceFile' => [ + 'offsetsFile' => [ 'reverses' => true, 'fileProvider' => 'PHPCoord\\CoordinateOperation\\NTv2NAD27NAD83CSRS2002BritishColumbiaCRDProvider', ], ], 'urn:ogc:def:coordinateOperation:EPSG::9117' => [ - 'latitudeAndLongitudeDifferenceFile' => [ + 'offsetsFile' => [ 'reverses' => true, 'fileProvider' => 'PHPCoord\\CoordinateOperation\\NTv2NAD831986NAD83CSRS1997BritishColumbiaCRDProvider', ], ], 'urn:ogc:def:coordinateOperation:EPSG::9118' => [ - 'latitudeAndLongitudeDifferenceFile' => [ + 'offsetsFile' => [ 'reverses' => true, 'fileProvider' => 'PHPCoord\\CoordinateOperation\\NTv2NAD831986NAD83CSRS1997BritishColumbiaVancouverIslandProvider', ], ], 'urn:ogc:def:coordinateOperation:EPSG::9119' => [ - 'latitudeAndLongitudeDifferenceFile' => [ + 'offsetsFile' => [ 'reverses' => true, 'fileProvider' => 'PHPCoord\\CoordinateOperation\\NTv2NAD831986NAD83CSRS2002BritishColumbiaCRDProvider', ], @@ -59303,13 +59293,13 @@ class CoordinateOperationParams ], ], 'urn:ogc:def:coordinateOperation:EPSG::9232' => [ - 'latitudeAndLongitudeDifferenceFile' => [ + 'offsetsFile' => [ 'reverses' => true, 'fileProvider' => 'PHPCoord\\CoordinateOperation\\NTv2ISN93ISN2016IcelandProvider', ], ], 'urn:ogc:def:coordinateOperation:EPSG::9233' => [ - 'latitudeAndLongitudeDifferenceFile' => [ + 'offsetsFile' => [ 'reverses' => true, 'fileProvider' => 'PHPCoord\\CoordinateOperation\\NTv2ISN2004ISN2016IcelandProvider', ], @@ -59352,55 +59342,55 @@ class CoordinateOperationParams ], ], 'urn:ogc:def:coordinateOperation:EPSG::9236' => [ - 'latitudeAndLongitudeDifferenceFile' => [ + 'offsetsFile' => [ 'reverses' => true, 'fileProvider' => 'PHPCoord\\CoordinateOperation\\NTv2ATS777NAD83CSRS1997PrinceEdwardProvider', ], ], 'urn:ogc:def:coordinateOperation:EPSG::9237' => [ - 'latitudeAndLongitudeDifferenceFile' => [ + 'offsetsFile' => [ 'reverses' => true, 'fileProvider' => 'PHPCoord\\CoordinateOperation\\NTv2ATS77NAD83CSRS1997NewBrunswickProvider', ], ], 'urn:ogc:def:coordinateOperation:EPSG::9238' => [ - 'latitudeAndLongitudeDifferenceFile' => [ + 'offsetsFile' => [ 'reverses' => true, 'fileProvider' => 'PHPCoord\\CoordinateOperation\\NTv2NAD27NAD83CSRS1997NewBrunswickProvider', ], ], 'urn:ogc:def:coordinateOperation:EPSG::9239' => [ - 'latitudeAndLongitudeDifferenceFile' => [ + 'offsetsFile' => [ 'reverses' => true, 'fileProvider' => 'PHPCoord\\CoordinateOperation\\NTv2NAD27NAD83CSRS1997QuebecProvider', ], ], 'urn:ogc:def:coordinateOperation:EPSG::9240' => [ - 'latitudeAndLongitudeDifferenceFile' => [ + 'offsetsFile' => [ 'reverses' => true, 'fileProvider' => 'PHPCoord\\CoordinateOperation\\NTv2NAD27CGQ77NAD83CSRS1997QuebecProvider', ], ], 'urn:ogc:def:coordinateOperation:EPSG::9241' => [ - 'latitudeAndLongitudeDifferenceFile' => [ + 'offsetsFile' => [ 'reverses' => true, 'fileProvider' => 'PHPCoord\\CoordinateOperation\\NTv2NAD831986NAD83CSRS1997QuebecProvider', ], ], 'urn:ogc:def:coordinateOperation:EPSG::9242' => [ - 'latitudeAndLongitudeDifferenceFile' => [ + 'offsetsFile' => [ 'reverses' => true, 'fileProvider' => 'PHPCoord\\CoordinateOperation\\NTv2NAD27NAD83CSRS1997SaskatchewanProvider', ], ], 'urn:ogc:def:coordinateOperation:EPSG::9243' => [ - 'latitudeAndLongitudeDifferenceFile' => [ + 'offsetsFile' => [ 'reverses' => true, 'fileProvider' => 'PHPCoord\\CoordinateOperation\\NTv2NAD831986NAD83CSRS1997SaskatchewanProvider', ], ], 'urn:ogc:def:coordinateOperation:EPSG::9244' => [ - 'latitudeAndLongitudeDifferenceFile' => [ + 'offsetsFile' => [ 'reverses' => true, 'fileProvider' => 'PHPCoord\\CoordinateOperation\\NTv2NAD831986NAD83CSRS2002AlbertaProvider', ], @@ -59660,7 +59650,7 @@ class CoordinateOperationParams ], ], 'urn:ogc:def:coordinateOperation:EPSG::9282' => [ - 'latitudeAndLongitudeDifferenceFile' => [ + 'offsetsFile' => [ 'reverses' => true, 'fileProvider' => 'PHPCoord\\CoordinateOperation\\NTv2RDETRS89NetherlandsProvider', ], @@ -59753,153 +59743,88 @@ class CoordinateOperationParams ], ], 'urn:ogc:def:coordinateOperation:EPSG::9310' => [ - 'latitudeAndLongitudeDifferenceFile' => [ + 'offsetsFile' => [ 'reverses' => true, 'fileProvider' => 'PHPCoord\\CoordinateOperation\\NTv2DHDNETRS89SaarlandProvider', ], ], 'urn:ogc:def:coordinateOperation:EPSG::9312' => [ - 'verticalOffsetFile' => [ + 'offsetsFile' => [ 'reverses' => true, 'fileProvider' => 'PHPCoord\\CoordinateOperation\\GTXAuckland1946NZVD2016Provider', ], - 'EPSGCodeForInterpolationCRS' => [ - 'value' => 'urn:ogc:def:crs:EPSG::4167', - 'uom' => null, - 'reverses' => false, - ], ], 'urn:ogc:def:coordinateOperation:EPSG::9313' => [ - 'verticalOffsetFile' => [ + 'offsetsFile' => [ 'reverses' => true, 'fileProvider' => 'PHPCoord\\CoordinateOperation\\GTXBluff1955NZVD2016Provider', ], - 'EPSGCodeForInterpolationCRS' => [ - 'value' => 'urn:ogc:def:crs:EPSG::4167', - 'uom' => null, - 'reverses' => false, - ], ], 'urn:ogc:def:coordinateOperation:EPSG::9314' => [ - 'verticalOffsetFile' => [ + 'offsetsFile' => [ 'reverses' => true, 'fileProvider' => 'PHPCoord\\CoordinateOperation\\GTXDunedin1958NZVD2016Provider', ], - 'EPSGCodeForInterpolationCRS' => [ - 'value' => 'urn:ogc:def:crs:EPSG::4167', - 'uom' => null, - 'reverses' => false, - ], ], 'urn:ogc:def:coordinateOperation:EPSG::9315' => [ - 'verticalOffsetFile' => [ + 'offsetsFile' => [ 'reverses' => true, 'fileProvider' => 'PHPCoord\\CoordinateOperation\\GTXDunedinBluff1960NZVD2016Provider', ], - 'EPSGCodeForInterpolationCRS' => [ - 'value' => 'urn:ogc:def:crs:EPSG::4167', - 'uom' => null, - 'reverses' => false, - ], ], 'urn:ogc:def:coordinateOperation:EPSG::9316' => [ - 'verticalOffsetFile' => [ + 'offsetsFile' => [ 'reverses' => true, 'fileProvider' => 'PHPCoord\\CoordinateOperation\\GTXGisborne1926NZVD2016Provider', ], - 'EPSGCodeForInterpolationCRS' => [ - 'value' => 'urn:ogc:def:crs:EPSG::4167', - 'uom' => null, - 'reverses' => false, - ], ], 'urn:ogc:def:coordinateOperation:EPSG::9317' => [ - 'verticalOffsetFile' => [ + 'offsetsFile' => [ 'reverses' => true, 'fileProvider' => 'PHPCoord\\CoordinateOperation\\GTXLyttelton1937NZVD2016Provider', ], - 'EPSGCodeForInterpolationCRS' => [ - 'value' => 'urn:ogc:def:crs:EPSG::4167', - 'uom' => null, - 'reverses' => false, - ], ], 'urn:ogc:def:coordinateOperation:EPSG::9318' => [ - 'verticalOffsetFile' => [ + 'offsetsFile' => [ 'reverses' => true, 'fileProvider' => 'PHPCoord\\CoordinateOperation\\GTXMoturiki1953NZVD2016Provider', ], - 'EPSGCodeForInterpolationCRS' => [ - 'value' => 'urn:ogc:def:crs:EPSG::4167', - 'uom' => null, - 'reverses' => false, - ], ], 'urn:ogc:def:coordinateOperation:EPSG::9319' => [ - 'verticalOffsetFile' => [ + 'offsetsFile' => [ 'reverses' => true, 'fileProvider' => 'PHPCoord\\CoordinateOperation\\GTXNapier1962NZVD2016Provider', ], - 'EPSGCodeForInterpolationCRS' => [ - 'value' => 'urn:ogc:def:crs:EPSG::4167', - 'uom' => null, - 'reverses' => false, - ], ], 'urn:ogc:def:coordinateOperation:EPSG::9320' => [ - 'verticalOffsetFile' => [ + 'offsetsFile' => [ 'reverses' => true, 'fileProvider' => 'PHPCoord\\CoordinateOperation\\GTXNelson1955NZVD2016Provider', ], - 'EPSGCodeForInterpolationCRS' => [ - 'value' => 'urn:ogc:def:crs:EPSG::4167', - 'uom' => null, - 'reverses' => false, - ], ], 'urn:ogc:def:coordinateOperation:EPSG::9321' => [ - 'verticalOffsetFile' => [ + 'offsetsFile' => [ 'reverses' => true, 'fileProvider' => 'PHPCoord\\CoordinateOperation\\GTXOneTreePoint1964NZVD2016Provider', ], - 'EPSGCodeForInterpolationCRS' => [ - 'value' => 'urn:ogc:def:crs:EPSG::4167', - 'uom' => null, - 'reverses' => false, - ], ], 'urn:ogc:def:coordinateOperation:EPSG::9322' => [ - 'verticalOffsetFile' => [ + 'offsetsFile' => [ 'reverses' => true, 'fileProvider' => 'PHPCoord\\CoordinateOperation\\GTXStewartIsland1977NZVD2016Provider', ], - 'EPSGCodeForInterpolationCRS' => [ - 'value' => 'urn:ogc:def:crs:EPSG::4167', - 'uom' => null, - 'reverses' => false, - ], ], 'urn:ogc:def:coordinateOperation:EPSG::9323' => [ - 'verticalOffsetFile' => [ + 'offsetsFile' => [ 'reverses' => true, 'fileProvider' => 'PHPCoord\\CoordinateOperation\\GTXTaranaki1970NZVD2016Provider', ], - 'EPSGCodeForInterpolationCRS' => [ - 'value' => 'urn:ogc:def:crs:EPSG::4167', - 'uom' => null, - 'reverses' => false, - ], ], 'urn:ogc:def:coordinateOperation:EPSG::9324' => [ - 'verticalOffsetFile' => [ + 'offsetsFile' => [ 'reverses' => true, 'fileProvider' => 'PHPCoord\\CoordinateOperation\\GTXWellington1953NZVD2016Provider', ], - 'EPSGCodeForInterpolationCRS' => [ - 'value' => 'urn:ogc:def:crs:EPSG::4167', - 'uom' => null, - 'reverses' => false, - ], ], 'urn:ogc:def:coordinateOperation:EPSG::9325' => [ 'geoidHeightCorrectionModelFile' => [ @@ -59914,68 +59839,28 @@ class CoordinateOperationParams ], ], 'urn:ogc:def:coordinateOperation:EPSG::9327' => [ - 'geocentricTranslationFile' => [ + 'offsetsFile' => [ 'reverses' => true, 'fileProvider' => 'PHPCoord\\CoordinateOperation\\IGNFGeocentricTranslationNTFRGF93Provider', ], - 'EPSGCodeForInterpolationCRS' => [ - 'value' => 'urn:ogc:def:crs:EPSG::4171', - 'uom' => null, - 'reverses' => false, - ], - 'EPSGCodeForStandardCT' => [ - 'value' => 'urn:ogc:def:coordinateOperation:EPSG::1651', - 'uom' => null, - 'reverses' => false, - ], ], 'urn:ogc:def:coordinateOperation:EPSG::9328' => [ - 'geocentricTranslationFile' => [ + 'offsetsFile' => [ 'reverses' => true, 'fileProvider' => 'PHPCoord\\CoordinateOperation\\IGNFGeocentricTranslationNEA74NoumeaRGNC9193Provider', ], - 'EPSGCodeForInterpolationCRS' => [ - 'value' => 'urn:ogc:def:crs:EPSG::4749', - 'uom' => null, - 'reverses' => false, - ], - 'EPSGCodeForStandardCT' => [ - 'value' => 'urn:ogc:def:coordinateOperation:EPSG::15886', - 'uom' => null, - 'reverses' => false, - ], ], 'urn:ogc:def:coordinateOperation:EPSG::9329' => [ - 'geocentricTranslationFile' => [ + 'offsetsFile' => [ 'reverses' => true, 'fileProvider' => 'PHPCoord\\CoordinateOperation\\IGNFGeocentricTranslationIGN72GrandeTerreRGNC9193Provider', ], - 'EPSGCodeForInterpolationCRS' => [ - 'value' => 'urn:ogc:def:crs:EPSG::4749', - 'uom' => null, - 'reverses' => false, - ], - 'EPSGCodeForStandardCT' => [ - 'value' => 'urn:ogc:def:coordinateOperation:EPSG::15882', - 'uom' => null, - 'reverses' => false, - ], ], 'urn:ogc:def:coordinateOperation:EPSG::9330' => [ - 'geocentricTranslationFile' => [ + 'offsetsFile' => [ 'reverses' => true, 'fileProvider' => 'PHPCoord\\CoordinateOperation\\IGNFGeocentricTranslationIGN72GrandeTerreRGNC9193NoumeaProvider', ], - 'EPSGCodeForInterpolationCRS' => [ - 'value' => 'urn:ogc:def:crs:EPSG::4749', - 'uom' => null, - 'reverses' => false, - ], - 'EPSGCodeForStandardCT' => [ - 'value' => 'urn:ogc:def:coordinateOperation:EPSG::15882', - 'uom' => null, - 'reverses' => false, - ], ], 'urn:ogc:def:coordinateOperation:EPSG::9334' => [ 'xAxisTranslation' => [ @@ -60577,13 +60462,13 @@ class CoordinateOperationParams ], ], 'urn:ogc:def:coordinateOperation:EPSG::9408' => [ - 'latitudeAndLongitudeDifferenceFile' => [ + 'offsetsFile' => [ 'reverses' => true, 'fileProvider' => 'PHPCoord\\CoordinateOperation\\NTv2ED50ETRS89SpainProvider', ], ], 'urn:ogc:def:coordinateOperation:EPSG::9409' => [ - 'latitudeAndLongitudeDifferenceFile' => [ + 'offsetsFile' => [ 'reverses' => true, 'fileProvider' => 'PHPCoord\\CoordinateOperation\\NTv2ED50ETRS89BalearicIslandsProvider', ], @@ -60806,22 +60691,12 @@ class CoordinateOperationParams 'reverses' => true, 'fileProvider' => 'PHPCoord\\CoordinateOperation\\GTXGDA2020AHDProvider', ], - 'EPSGCodeForInterpolationCRS' => [ - 'value' => 'urn:ogc:def:crs:EPSG::7844', - 'uom' => null, - 'reverses' => false, - ], ], 'urn:ogc:def:coordinateOperation:EPSG::9467' => [ 'geoidHeightCorrectionModelFile' => [ 'reverses' => true, 'fileProvider' => 'PHPCoord\\CoordinateOperation\\GTXGDA94AHDProvider', ], - 'EPSGCodeForInterpolationCRS' => [ - 'value' => 'urn:ogc:def:crs:EPSG::4283', - 'uom' => null, - 'reverses' => false, - ], ], 'urn:ogc:def:coordinateOperation:EPSG::9472' => [ 'xAxisTranslation' => [ @@ -61006,7 +60881,7 @@ class CoordinateOperationParams ], ], 'urn:ogc:def:coordinateOperation:EPSG::9550' => [ - 'latitudeAndLongitudeDifferenceFile' => [ + 'offsetsFile' => [ 'reverses' => true, 'fileProvider' => 'PHPCoord\\CoordinateOperation\\NTv2NAD831986NAD83CSRS2010NewfoundlandProvider', ], @@ -61037,451 +60912,246 @@ class CoordinateOperationParams 'reverses' => true, 'fileProvider' => 'PHPCoord\\CoordinateOperation\\OSTN15OSGM15Provider', ], - 'EPSGCodeForInterpolationCRS' => [ - 'value' => 'urn:ogc:def:crs:EPSG::4258', - 'uom' => null, - 'reverses' => false, - ], ], 'urn:ogc:def:coordinateOperation:EPSG::9585' => [ 'geoidHeightCorrectionModelFile' => [ 'reverses' => true, 'fileProvider' => 'PHPCoord\\CoordinateOperation\\OSTN15OSGM15Provider', ], - 'EPSGCodeForInterpolationCRS' => [ - 'value' => 'urn:ogc:def:crs:EPSG::4258', - 'uom' => null, - 'reverses' => false, - ], ], 'urn:ogc:def:coordinateOperation:EPSG::9586' => [ 'geoidHeightCorrectionModelFile' => [ 'reverses' => true, 'fileProvider' => 'PHPCoord\\CoordinateOperation\\OSTN15OSGM15Provider', ], - 'EPSGCodeForInterpolationCRS' => [ - 'value' => 'urn:ogc:def:crs:EPSG::4258', - 'uom' => null, - 'reverses' => false, - ], ], 'urn:ogc:def:coordinateOperation:EPSG::9587' => [ 'geoidHeightCorrectionModelFile' => [ 'reverses' => true, 'fileProvider' => 'PHPCoord\\CoordinateOperation\\OSTN15OSGM15Provider', ], - 'EPSGCodeForInterpolationCRS' => [ - 'value' => 'urn:ogc:def:crs:EPSG::4258', - 'uom' => null, - 'reverses' => false, - ], ], 'urn:ogc:def:coordinateOperation:EPSG::9588' => [ 'geoidHeightCorrectionModelFile' => [ 'reverses' => true, 'fileProvider' => 'PHPCoord\\CoordinateOperation\\OSTN15OSGM15Provider', ], - 'EPSGCodeForInterpolationCRS' => [ - 'value' => 'urn:ogc:def:crs:EPSG::4258', - 'uom' => null, - 'reverses' => false, - ], ], 'urn:ogc:def:coordinateOperation:EPSG::9589' => [ 'geoidHeightCorrectionModelFile' => [ 'reverses' => true, 'fileProvider' => 'PHPCoord\\CoordinateOperation\\OSTN15OSGM15Provider', ], - 'EPSGCodeForInterpolationCRS' => [ - 'value' => 'urn:ogc:def:crs:EPSG::4258', - 'uom' => null, - 'reverses' => false, - ], ], 'urn:ogc:def:coordinateOperation:EPSG::9590' => [ 'geoidHeightCorrectionModelFile' => [ 'reverses' => true, 'fileProvider' => 'PHPCoord\\CoordinateOperation\\OSTN15OSGM15Provider', ], - 'EPSGCodeForInterpolationCRS' => [ - 'value' => 'urn:ogc:def:crs:EPSG::4258', - 'uom' => null, - 'reverses' => false, - ], ], 'urn:ogc:def:coordinateOperation:EPSG::9593' => [ 'geoidHeightCorrectionModelFile' => [ 'reverses' => true, 'fileProvider' => 'PHPCoord\\CoordinateOperation\\GTXETRS89NN2000Provider', ], - 'EPSGCodeForInterpolationCRS' => [ - 'value' => 'urn:ogc:def:crs:EPSG::4258', - 'uom' => null, - 'reverses' => false, - ], ], 'urn:ogc:def:coordinateOperation:EPSG::9594' => [ 'geoidHeightCorrectionModelFile' => [ 'reverses' => true, 'fileProvider' => 'PHPCoord\\CoordinateOperation\\GTXETRS89NN1954Provider', ], - 'EPSGCodeForInterpolationCRS' => [ - 'value' => 'urn:ogc:def:crs:EPSG::4258', - 'uom' => null, - 'reverses' => false, - ], ], 'urn:ogc:def:coordinateOperation:EPSG::9595' => [ 'geoidHeightCorrectionModelFile' => [ 'reverses' => true, 'fileProvider' => 'PHPCoord\\CoordinateOperation\\GTXGEOID18CONUSProvider', ], - 'EPSGCodeForInterpolationCRS' => [ - 'value' => 'urn:ogc:def:crs:EPSG::6318', - 'uom' => null, - 'reverses' => false, - ], ], 'urn:ogc:def:coordinateOperation:EPSG::9596' => [ 'geoidHeightCorrectionModelFile' => [ 'reverses' => true, 'fileProvider' => 'PHPCoord\\CoordinateOperation\\GTXGEOID12BAlaskaProvider', ], - 'EPSGCodeForInterpolationCRS' => [ - 'value' => 'urn:ogc:def:crs:EPSG::6318', - 'uom' => null, - 'reverses' => false, - ], ], 'urn:ogc:def:coordinateOperation:EPSG::9597' => [ 'geoidHeightCorrectionModelFile' => [ 'reverses' => true, 'fileProvider' => 'PHPCoord\\CoordinateOperation\\GTXETRS89NAPProvider', ], - 'EPSGCodeForInterpolationCRS' => [ - 'value' => 'urn:ogc:def:crs:EPSG::4258', - 'uom' => null, - 'reverses' => false, - ], ], 'urn:ogc:def:coordinateOperation:EPSG::9605' => [ 'geoidHeightCorrectionModelFile' => [ 'reverses' => true, 'fileProvider' => 'PHPCoord\\CoordinateOperation\\IGNESHeightETRS89REDNAPSpainProvider', ], - 'EPSGCodeForInterpolationCRS' => [ - 'value' => 'urn:ogc:def:crs:EPSG::4258', - 'uom' => null, - 'reverses' => false, - ], ], 'urn:ogc:def:coordinateOperation:EPSG::9606' => [ 'geoidHeightCorrectionModelFile' => [ 'reverses' => true, 'fileProvider' => 'PHPCoord\\CoordinateOperation\\IGNESHeightETRS89REDNAPSpainProvider', ], - 'EPSGCodeForInterpolationCRS' => [ - 'value' => 'urn:ogc:def:crs:EPSG::4258', - 'uom' => null, - 'reverses' => false, - ], ], 'urn:ogc:def:coordinateOperation:EPSG::9607' => [ 'geoidHeightCorrectionModelFile' => [ 'reverses' => true, 'fileProvider' => 'PHPCoord\\CoordinateOperation\\IGNESHeightETRS89REDNAPSpainProvider', ], - 'EPSGCodeForInterpolationCRS' => [ - 'value' => 'urn:ogc:def:crs:EPSG::4258', - 'uom' => null, - 'reverses' => false, - ], ], 'urn:ogc:def:coordinateOperation:EPSG::9608' => [ 'geoidHeightCorrectionModelFile' => [ 'reverses' => true, 'fileProvider' => 'PHPCoord\\CoordinateOperation\\IGNESHeightETRS89REDNAPSpainProvider', ], - 'EPSGCodeForInterpolationCRS' => [ - 'value' => 'urn:ogc:def:crs:EPSG::4258', - 'uom' => null, - 'reverses' => false, - ], ], 'urn:ogc:def:coordinateOperation:EPSG::9609' => [ 'geoidHeightCorrectionModelFile' => [ 'reverses' => true, 'fileProvider' => 'PHPCoord\\CoordinateOperation\\IGNESHeightETRS89REDNAPSpainProvider', ], - 'EPSGCodeForInterpolationCRS' => [ - 'value' => 'urn:ogc:def:crs:EPSG::4258', - 'uom' => null, - 'reverses' => false, - ], ], 'urn:ogc:def:coordinateOperation:EPSG::9610' => [ 'geoidHeightCorrectionModelFile' => [ 'reverses' => true, 'fileProvider' => 'PHPCoord\\CoordinateOperation\\IGNESHeightETRS89REDNAPCanaryIslandsProvider', ], - 'EPSGCodeForInterpolationCRS' => [ - 'value' => 'urn:ogc:def:crs:EPSG::4081', - 'uom' => null, - 'reverses' => false, - ], ], 'urn:ogc:def:coordinateOperation:EPSG::9611' => [ 'geoidHeightCorrectionModelFile' => [ 'reverses' => true, 'fileProvider' => 'PHPCoord\\CoordinateOperation\\IGNESHeightETRS89REDNAPCanaryIslandsProvider', ], - 'EPSGCodeForInterpolationCRS' => [ - 'value' => 'urn:ogc:def:crs:EPSG::4081', - 'uom' => null, - 'reverses' => false, - ], ], 'urn:ogc:def:coordinateOperation:EPSG::9612' => [ 'geoidHeightCorrectionModelFile' => [ 'reverses' => true, 'fileProvider' => 'PHPCoord\\CoordinateOperation\\IGNESHeightETRS89REDNAPCanaryIslandsProvider', ], - 'EPSGCodeForInterpolationCRS' => [ - 'value' => 'urn:ogc:def:crs:EPSG::4081', - 'uom' => null, - 'reverses' => false, - ], ], 'urn:ogc:def:coordinateOperation:EPSG::9613' => [ 'geoidHeightCorrectionModelFile' => [ 'reverses' => true, 'fileProvider' => 'PHPCoord\\CoordinateOperation\\IGNESHeightETRS89REDNAPCanaryIslandsProvider', ], - 'EPSGCodeForInterpolationCRS' => [ - 'value' => 'urn:ogc:def:crs:EPSG::4081', - 'uom' => null, - 'reverses' => false, - ], ], 'urn:ogc:def:coordinateOperation:EPSG::9614' => [ 'geoidHeightCorrectionModelFile' => [ 'reverses' => true, 'fileProvider' => 'PHPCoord\\CoordinateOperation\\IGNESHeightETRS89REDNAPCanaryIslandsProvider', ], - 'EPSGCodeForInterpolationCRS' => [ - 'value' => 'urn:ogc:def:crs:EPSG::4081', - 'uom' => null, - 'reverses' => false, - ], ], 'urn:ogc:def:coordinateOperation:EPSG::9615' => [ 'geoidHeightCorrectionModelFile' => [ 'reverses' => true, 'fileProvider' => 'PHPCoord\\CoordinateOperation\\IGNESHeightETRS89REDNAPCanaryIslandsProvider', ], - 'EPSGCodeForInterpolationCRS' => [ - 'value' => 'urn:ogc:def:crs:EPSG::4081', - 'uom' => null, - 'reverses' => false, - ], ], 'urn:ogc:def:coordinateOperation:EPSG::9616' => [ 'geoidHeightCorrectionModelFile' => [ 'reverses' => true, 'fileProvider' => 'PHPCoord\\CoordinateOperation\\IGNESHeightETRS89REDNAPCanaryIslandsProvider', ], - 'EPSGCodeForInterpolationCRS' => [ - 'value' => 'urn:ogc:def:crs:EPSG::4081', - 'uom' => null, - 'reverses' => false, - ], ], 'urn:ogc:def:coordinateOperation:EPSG::9622' => [ 'geoidHeightCorrectionModelFile' => [ 'reverses' => true, 'fileProvider' => 'PHPCoord\\CoordinateOperation\\GTXGEOID18PRVIProvider', ], - 'EPSGCodeForInterpolationCRS' => [ - 'value' => 'urn:ogc:def:crs:EPSG::6318', - 'uom' => null, - 'reverses' => false, - ], ], 'urn:ogc:def:coordinateOperation:EPSG::9623' => [ 'geoidHeightCorrectionModelFile' => [ 'reverses' => true, 'fileProvider' => 'PHPCoord\\CoordinateOperation\\GTXGEOID18PRVIProvider', ], - 'EPSGCodeForInterpolationCRS' => [ - 'value' => 'urn:ogc:def:crs:EPSG::6318', - 'uom' => null, - 'reverses' => false, - ], ], 'urn:ogc:def:coordinateOperation:EPSG::9624' => [ 'geoidHeightCorrectionModelFile' => [ 'reverses' => true, 'fileProvider' => 'PHPCoord\\CoordinateOperation\\GTXGEOID12BGuamMIProvider', ], - 'EPSGCodeForInterpolationCRS' => [ - 'value' => 'urn:ogc:def:crs:EPSG::6325', - 'uom' => null, - 'reverses' => false, - ], ], 'urn:ogc:def:coordinateOperation:EPSG::9625' => [ 'geoidHeightCorrectionModelFile' => [ 'reverses' => true, 'fileProvider' => 'PHPCoord\\CoordinateOperation\\GTXGEOID12BGuamMIProvider', ], - 'EPSGCodeForInterpolationCRS' => [ - 'value' => 'urn:ogc:def:crs:EPSG::6325', - 'uom' => null, - 'reverses' => false, - ], ], 'urn:ogc:def:coordinateOperation:EPSG::9626' => [ 'geoidHeightCorrectionModelFile' => [ 'reverses' => true, 'fileProvider' => 'PHPCoord\\CoordinateOperation\\GTXGEOID12BAmericaSamoaProvider', ], - 'EPSGCodeForInterpolationCRS' => [ - 'value' => 'urn:ogc:def:crs:EPSG::6322', - 'uom' => null, - 'reverses' => false, - ], ], 'urn:ogc:def:coordinateOperation:EPSG::9627' => [ 'geoidHeightCorrectionModelFile' => [ 'reverses' => true, 'fileProvider' => 'PHPCoord\\CoordinateOperation\\GTXNZGeoid2009Provider', ], - 'EPSGCodeForInterpolationCRS' => [ - 'value' => 'urn:ogc:def:crs:EPSG::4167', - 'uom' => null, - 'reverses' => false, - ], ], 'urn:ogc:def:coordinateOperation:EPSG::9628' => [ 'geoidHeightCorrectionModelFile' => [ 'reverses' => true, 'fileProvider' => 'PHPCoord\\CoordinateOperation\\GTXNZGeoid2016Provider', ], - 'EPSGCodeForInterpolationCRS' => [ - 'value' => 'urn:ogc:def:crs:EPSG::4167', - 'uom' => null, - 'reverses' => false, - ], ], 'urn:ogc:def:coordinateOperation:EPSG::9631' => [ 'geoidHeightCorrectionModelFile' => [ 'reverses' => true, 'fileProvider' => 'PHPCoord\\CoordinateOperation\\IGNFHeightRGAF09Guadeloupe1988Provider', ], - 'EPSGCodeForInterpolationCRS' => [ - 'value' => 'urn:ogc:def:crs:EPSG::5489', - 'uom' => null, - 'reverses' => false, - ], ], 'urn:ogc:def:coordinateOperation:EPSG::9632' => [ 'geoidHeightCorrectionModelFile' => [ 'reverses' => true, 'fileProvider' => 'PHPCoord\\CoordinateOperation\\IGNFHeightRGAF09IGN1988LesSaintesProvider', ], - 'EPSGCodeForInterpolationCRS' => [ - 'value' => 'urn:ogc:def:crs:EPSG::5489', - 'uom' => null, - 'reverses' => false, - ], ], 'urn:ogc:def:coordinateOperation:EPSG::9633' => [ 'geoidHeightCorrectionModelFile' => [ 'reverses' => true, 'fileProvider' => 'PHPCoord\\CoordinateOperation\\IGNFHeightRGAF09IGN1988MarieGalanteProvider', ], - 'EPSGCodeForInterpolationCRS' => [ - 'value' => 'urn:ogc:def:crs:EPSG::5489', - 'uom' => null, - 'reverses' => false, - ], ], 'urn:ogc:def:coordinateOperation:EPSG::9634' => [ 'geoidHeightCorrectionModelFile' => [ 'reverses' => true, 'fileProvider' => 'PHPCoord\\CoordinateOperation\\IGNFHeightRGAF09IGN1988SaintBarthelemyProvider', ], - 'EPSGCodeForInterpolationCRS' => [ - 'value' => 'urn:ogc:def:crs:EPSG::5489', - 'uom' => null, - 'reverses' => false, - ], ], 'urn:ogc:def:coordinateOperation:EPSG::9635' => [ 'geoidHeightCorrectionModelFile' => [ 'reverses' => true, 'fileProvider' => 'PHPCoord\\CoordinateOperation\\IGNFHeightRGAF09IGN1988SaintMartinProvider', ], - 'EPSGCodeForInterpolationCRS' => [ - 'value' => 'urn:ogc:def:crs:EPSG::5489', - 'uom' => null, - 'reverses' => false, - ], ], 'urn:ogc:def:coordinateOperation:EPSG::9636' => [ 'geoidHeightCorrectionModelFile' => [ 'reverses' => true, 'fileProvider' => 'PHPCoord\\CoordinateOperation\\IGNFHeightRGAF09IGN2008LaDesiradeProvider', ], - 'EPSGCodeForInterpolationCRS' => [ - 'value' => 'urn:ogc:def:crs:EPSG::5489', - 'uom' => null, - 'reverses' => false, - ], ], 'urn:ogc:def:coordinateOperation:EPSG::9637' => [ 'geoidHeightCorrectionModelFile' => [ 'reverses' => true, 'fileProvider' => 'PHPCoord\\CoordinateOperation\\IGNFHeightRGAF09Martinique1987Provider', ], - 'EPSGCodeForInterpolationCRS' => [ - 'value' => 'urn:ogc:def:crs:EPSG::5489', - 'uom' => null, - 'reverses' => false, - ], ], 'urn:ogc:def:coordinateOperation:EPSG::9640' => [ 'geoidHeightCorrectionModelFile' => [ 'reverses' => true, 'fileProvider' => 'PHPCoord\\CoordinateOperation\\IGNFHeightRGNC9193NGNC08NewCaledoniaProvider', ], - 'EPSGCodeForInterpolationCRS' => [ - 'value' => 'urn:ogc:def:crs:EPSG::4749', - 'uom' => null, - 'reverses' => false, - ], ], 'urn:ogc:def:coordinateOperation:EPSG::9641' => [ 'geoidHeightCorrectionModelFile' => [ 'reverses' => true, 'fileProvider' => 'PHPCoord\\CoordinateOperation\\IGNFHeightRGSPM06Danger1950Provider', ], - 'EPSGCodeForInterpolationCRS' => [ - 'value' => 'urn:ogc:def:crs:EPSG::4463', - 'uom' => null, - 'reverses' => false, - ], ], 'urn:ogc:def:coordinateOperation:EPSG::9642' => [ 'geoidHeightCorrectionModelFile' => [ 'reverses' => true, 'fileProvider' => 'PHPCoord\\CoordinateOperation\\IGNFHeightWGS84IGN2008LaDesiradeProvider', ], - 'EPSGCodeForInterpolationCRS' => [ - 'value' => 'urn:ogc:def:crs:EPSG::4558', - 'uom' => null, - 'reverses' => false, - ], ], 'urn:ogc:def:coordinateOperation:EPSG::9673' => [ 'latitudeOfFalseOrigin' => [ @@ -61865,7 +61535,7 @@ class CoordinateOperationParams ], ], 'urn:ogc:def:coordinateOperation:EPSG::9689' => [ - 'latitudeAndLongitudeDifferenceFile' => [ + 'offsetsFile' => [ 'reverses' => true, 'fileProvider' => 'PHPCoord\\CoordinateOperation\\NTv2GDA94GDA2020AustraliaProvider', ], @@ -61908,7 +61578,7 @@ class CoordinateOperationParams ], ], 'urn:ogc:def:coordinateOperation:EPSG::9691' => [ - 'latitudeAndLongitudeDifferenceFile' => [ + 'offsetsFile' => [ 'reverses' => true, 'fileProvider' => 'PHPCoord\\CoordinateOperation\\NTv2GDA94GDA2020AustraliaProvider', ], @@ -61924,11 +61594,6 @@ class CoordinateOperationParams 'reverses' => true, 'fileProvider' => 'PHPCoord\\CoordinateOperation\\GTXGDA2020AVWSProvider', ], - 'EPSGCodeForInterpolationCRS' => [ - 'value' => 'urn:ogc:def:crs:EPSG::7844', - 'uom' => null, - 'reverses' => false, - ], ], 'urn:ogc:def:coordinateOperation:EPSG::9703' => [ 'xAxisTranslation' => [ @@ -62545,7 +62210,7 @@ class CoordinateOperationParams ], ], 'urn:ogc:def:coordinateOperation:EPSG::9795' => [ - 'latitudeAndLongitudeDifferenceFile' => [ + 'offsetsFile' => [ 'reverses' => true, 'fileProvider' => 'PHPCoord\\CoordinateOperation\\NTv2NAD831986NAD83CSRS2010AlbertaProvider', ], @@ -62615,11 +62280,6 @@ class CoordinateOperationParams 'reverses' => true, 'fileProvider' => 'PHPCoord\\CoordinateOperation\\IGNFHeightRGF93v2bNGFIGN69FranceProvider', ], - 'EPSGCodeForInterpolationCRS' => [ - 'value' => 'urn:ogc:def:crs:EPSG::9782', - 'uom' => null, - 'reverses' => false, - ], ], 'urn:ogc:def:coordinateOperation:EPSG::10085' => [ 'xAxisTranslation' => [ @@ -74224,7 +73884,7 @@ class CoordinateOperationParams ], ], 'urn:ogc:def:coordinateOperation:EPSG::15486' => [ - 'latitudeAndLongitudeDifferenceFile' => [ + 'offsetsFile' => [ 'reverses' => true, 'fileProvider' => 'PHPCoord\\CoordinateOperation\\NTv2LV03LV95SwitzerlandProvider', ], @@ -77923,13 +77583,13 @@ class CoordinateOperationParams ], ], 'urn:ogc:def:coordinateOperation:EPSG::15785' => [ - 'latitudeAndLongitudeDifferenceFile' => [ + 'offsetsFile' => [ 'reverses' => true, 'fileProvider' => 'PHPCoord\\CoordinateOperation\\NTv2AGD84GDA94AustraliaProvider', ], ], 'urn:ogc:def:coordinateOperation:EPSG::15786' => [ - 'latitudeAndLongitudeDifferenceFile' => [ + 'offsetsFile' => [ 'reverses' => true, 'fileProvider' => 'PHPCoord\\CoordinateOperation\\NTv2AGD66GDA94AustraliaProvider', ], @@ -80793,13 +80453,13 @@ class CoordinateOperationParams ], ], 'urn:ogc:def:coordinateOperation:EPSG::15948' => [ - 'latitudeAndLongitudeDifferenceFile' => [ + 'offsetsFile' => [ 'reverses' => true, 'fileProvider' => 'PHPCoord\\CoordinateOperation\\NTv2DHDNETRS89GermanyProvider', ], ], 'urn:ogc:def:coordinateOperation:EPSG::15949' => [ - 'latitudeAndLongitudeDifferenceFile' => [ + 'offsetsFile' => [ 'reverses' => true, 'fileProvider' => 'PHPCoord\\CoordinateOperation\\NTv2DHDNETRS89GermanyProvider', ], @@ -81023,13 +80683,13 @@ class CoordinateOperationParams ], ], 'urn:ogc:def:coordinateOperation:EPSG::15954' => [ - 'latitudeAndLongitudeDifferenceFile' => [ + 'offsetsFile' => [ 'reverses' => true, 'fileProvider' => 'PHPCoord\\CoordinateOperation\\NTv2DHDNETRS89GermanyProvider', ], ], 'urn:ogc:def:coordinateOperation:EPSG::15955' => [ - 'latitudeAndLongitudeDifferenceFile' => [ + 'offsetsFile' => [ 'reverses' => true, 'fileProvider' => 'PHPCoord\\CoordinateOperation\\NTv2DHDNETRS89GermanyProvider', ], diff --git a/src/CoordinateOperation/GTXGrid.php b/src/CoordinateOperation/GTXGrid.php index e9ecba047..a0b346692 100644 --- a/src/CoordinateOperation/GTXGrid.php +++ b/src/CoordinateOperation/GTXGrid.php @@ -8,7 +8,7 @@ namespace PHPCoord\CoordinateOperation; -use PHPCoord\GeographicPoint; +use function in_array; use PHPCoord\UnitOfMeasure\Length\Metre; use SplFileObject; use function substr; @@ -17,16 +17,17 @@ /** * @see https://vdatum.noaa.gov/docs/gtx_info.html for documentation */ -class GTXGrid extends SplFileObject +class GTXGrid extends GeographicGeoidHeightGrid { use BilinearInterpolation; private int $headerLength; - private string $offsetDataType; + private string $shiftDataType; public function __construct($filename) { - parent::__construct($filename); + $this->gridFile = new SplFileObject($filename); + $this->storageOrder = self::STORAGE_ORDER_INCREASING_LONGITUDE_INCREASING_LATIITUDE; $header = $this->getHeader(); $this->startX = $header['xlonsw']; @@ -41,50 +42,57 @@ public function __construct($filename) } } - public function getAdjustment(GeographicPoint $point): Metre + /** + * @return Metre[] + */ + public function getValues($x, $y): array { - $latitude = $point->getLatitude()->getValue(); - $longitude = $point->getLongitude()->getValue(); - $offset = $this->interpolateBilinear($longitude, $latitude)[0]; + $shift = $this->interpolate($x, $y)[0]; // These are in millimeters for some reason... :/ - if (in_array($this->getBasename(), ['vertconc.gtx', 'vertcone.gtx', 'vertconw.gtx'], true)) { - $offset /= 1000; + if (in_array($this->gridFile->getBasename(), ['vertconc.gtx', 'vertcone.gtx', 'vertconw.gtx'], true)) { + $shift /= 1000; } - return new Metre($offset); + return [new Metre($shift)]; } private function getRecord(int $longitudeIndex, int $latitudeIndex): GridValues { - $offset = $this->headerLength + ($latitudeIndex * $this->numberOfColumns + $longitudeIndex) * 4; - $this->fseek($offset); - $rawRow = $this->fread(4); - $data = unpack("{$this->offsetDataType}offset", $rawRow); + $recordId = match ($this->storageOrder) { + self::STORAGE_ORDER_INCREASING_LATITUDE_INCREASING_LONGITUDE => $longitudeIndex * $this->numberOfRows + $latitudeIndex, + self::STORAGE_ORDER_INCREASING_LONGITUDE_DECREASING_LATIITUDE => ($this->numberOfRows - $latitudeIndex - 1) * $this->numberOfColumns + $longitudeIndex, + self::STORAGE_ORDER_INCREASING_LONGITUDE_INCREASING_LATIITUDE => $latitudeIndex * $this->numberOfColumns + $longitudeIndex, + }; + + $offset = $this->headerLength + $recordId * 4; + $this->gridFile->fseek($offset); + $rawRow = $this->gridFile->fread(4); + $data = unpack("{$this->shiftDataType}shift", $rawRow); return new GridValues( $longitudeIndex * $this->columnGridInterval + $this->startX, $latitudeIndex * $this->rowGridInterval + $this->startY, - [$data['offset']] + [$data['shift']] ); } private function getHeader(): array { - $this->fseek(0); - $rawHeader = $this->fread(44); + $this->gridFile->fseek(0); + $rawHeader = $this->gridFile->fread(44); $ikind = substr($rawHeader, 40, 4); if (unpack('Nikind', $ikind)['ikind'] === 1) { // big endian $this->headerLength = 44; - $this->offsetDataType = 'G'; + $this->shiftDataType = 'G'; $data = unpack('Exlatsw/Exlonsw/Edlat/Edlon/Nnlat/Nnlon', $rawHeader); } elseif (unpack('Vikind', $ikind)['ikind'] === 1) { // little endian $this->headerLength = 44; - $this->offsetDataType = 'g'; + $this->shiftDataType = 'g'; $data = unpack('exlatsw/exlonsw/edlat/edlon/Vnlat/Vnlon', $rawHeader); } else { // not all files (e.g. NZ) have this endian check column, assume big endian $this->headerLength = 40; - $this->offsetDataType = 'G'; + $this->shiftDataType = 'G'; $data = unpack('Exlatsw/Exlonsw/Edlat/Edlon/Nnlat/Nnlon', $rawHeader); } diff --git a/src/CoordinateOperation/GeographicGeoidHeightGrid.php b/src/CoordinateOperation/GeographicGeoidHeightGrid.php new file mode 100644 index 000000000..b9781508a --- /dev/null +++ b/src/CoordinateOperation/GeographicGeoidHeightGrid.php @@ -0,0 +1,26 @@ +getValues($location->getLongitude()->asDegrees()->getValue(), $location->getLatitude()->asDegrees()->getValue())[0]; + } +} diff --git a/src/CoordinateOperation/GeographicGrid.php b/src/CoordinateOperation/GeographicGrid.php new file mode 100644 index 000000000..ae8458f75 --- /dev/null +++ b/src/CoordinateOperation/GeographicGrid.php @@ -0,0 +1,48 @@ +getValues($point->getLongitude()->getValue(), $point->getLatitude()->getValue()); + + $latitude = $point->getLatitude()->add($shifts[0]); + $longitude = $point->getLongitude()->add($shifts[1]); + $height = $point->getHeight() && $shifts[2] ? $point->getHeight()->add($shifts[2]) : null; + + return GeographicPoint::create($latitude, $longitude, $height, $to, $point->getCoordinateEpoch()); + } + + public function applyReverseAdjustment(GeographicPoint $point, Geographic $to): GeographicPoint + { + $shifts = [new ArcSecond(0), new ArcSecond(0)]; + $latitude = $point->getLatitude(); + $longitude = $point->getLongitude(); + + do { + $prevShifts = $shifts; + $shifts = $this->getValues($longitude->getValue(), $latitude->getValue()); + $latitude = $point->getLatitude()->subtract($shifts[0]); + $longitude = $point->getLongitude()->subtract($shifts[1]); + } while (abs($shifts[0]->subtract($prevShifts[0])->getValue()) > self::ITERATION_CONVERGENCE && abs($shifts[1]->subtract($prevShifts[1])->getValue()) > self::ITERATION_CONVERGENCE); + + $height = $point->getHeight() && $shifts[2] ? $point->getHeight()->subtract($shifts[2]) : null; + + return GeographicPoint::create($latitude, $longitude, $height, $to, $point->getCoordinateEpoch()); + } +} diff --git a/src/CoordinateOperation/Grid.php b/src/CoordinateOperation/Grid.php new file mode 100644 index 000000000..94e34655a --- /dev/null +++ b/src/CoordinateOperation/Grid.php @@ -0,0 +1,31 @@ +gridFile = new SplFileObject($filename); $this->init(); } - public function getAdjustment(GeographicPoint $point): Metre + /** + * @return Metre[] + */ + public function getValues(float $x, float $y): array { - $latitude = $point->getLatitude()->getValue(); - $longitude = $point->getLongitude()->getValue(); - $offset = $this->interpolateBilinear($longitude, $latitude)[0]; + $shift = $this->interpolate($x, $y)[0]; - return new Metre($offset); + return [new Metre($shift)]; } protected function getRecord(int $longitudeIndex, int $latitudeIndex): GridValues @@ -72,7 +62,7 @@ protected function getRecord(int $longitudeIndex, int $latitudeIndex): GridValue private function init(): void { $headerRegexp = '^\s+(-?[\d.]+)\s+(-?[\d.]+)\s+(-?[\d.]+)\s+(-?[\d.]+)\s+([\d.]+)\s+([\d.]+)'; - $header = $this->fgets(); + $header = $this->gridFile->fgets(); preg_match('/' . $headerRegexp . '/', $header, $headerParts); @@ -92,7 +82,7 @@ private function init(): void $this->data = new SplFixedArray($this->numberOfColumns * $this->numberOfRows); - $rawData = $this->fread($this->getSize() - strlen($header)); + $rawData = $this->gridFile->fread($this->gridFile->getSize() - strlen($header)); $values = explode(' ', trim(preg_replace('/\s+/', ' ', $rawData))); $cursor = 0; diff --git a/src/CoordinateOperation/IGNFGeocentricTranslationGrid.php b/src/CoordinateOperation/IGNFGeocentricTranslationGrid.php index ba326f381..a8b146d42 100644 --- a/src/CoordinateOperation/IGNFGeocentricTranslationGrid.php +++ b/src/CoordinateOperation/IGNFGeocentricTranslationGrid.php @@ -11,16 +11,15 @@ use function abs; use PHPCoord\CoordinateReferenceSystem\Geographic; use PHPCoord\GeographicPoint; -use PHPCoord\UnitOfMeasure\Angle\Degree; use PHPCoord\UnitOfMeasure\Length\Metre; -class IGNFGeocentricTranslationGrid extends IGNFGrid +class IGNFGeocentricTranslationGrid extends GeographicGrid { - private const ITERATION_CONVERGENCE = 0.0001; + use IGNFGrid; public function applyForwardAdjustment(GeographicPoint $point, Geographic $to): GeographicPoint { - [$tx, $ty, $tz] = $this->getAdjustment($point->getLatitude()->asDegrees(), $point->getLongitude()->asDegrees()); + [$tx, $ty, $tz] = $this->getValues($point->getLongitude()->asDegrees()->getValue(), $point->getLatitude()->asDegrees()->getValue()); return $point->geocentricTranslation( $to, @@ -38,7 +37,7 @@ public function applyReverseAdjustment(GeographicPoint $point, Geographic $to): do { $prevAdjustment = $adjustment; - $adjustment = $this->getAdjustment($latitude->asDegrees(), $longitude->asDegrees()); + $adjustment = $this->getValues($longitude->asDegrees()->getValue(), $latitude->asDegrees()->getValue()); $newPoint = $point->geocentricTranslation( $to, $adjustment[0]->multiply(-1), @@ -56,9 +55,9 @@ public function applyReverseAdjustment(GeographicPoint $point, Geographic $to): /** * @return Metre[] */ - private function getAdjustment(Degree $latitude, Degree $longitude): array + public function getValues(float $x, float $y): array { - $offsets = $this->interpolateBilinear($longitude->getValue(), $latitude->getValue()); + $offsets = $this->interpolate($x, $y); return [new Metre($offsets[0]), new Metre($offsets[1]), new Metre($offsets[2])]; } diff --git a/src/CoordinateOperation/IGNFGrid.php b/src/CoordinateOperation/IGNFGrid.php index 9d4dd2cd6..86ce73f76 100644 --- a/src/CoordinateOperation/IGNFGrid.php +++ b/src/CoordinateOperation/IGNFGrid.php @@ -24,35 +24,19 @@ use function strlen; use function trim; -abstract class IGNFGrid extends SplFileObject +trait IGNFGrid { use BilinearInterpolation; - private const ITERATION_CONVERGENCE = 0.0001; - - private const STORAGE_ORDER_INCREASING_LATITUDE_INCREASING_LONGITUDE = 1; - - private const STORAGE_ORDER_INCREASING_LONGITUDE_DECREASING_LATIITUDE = 2; - - private const STORAGE_ORDER_DECREASING_LATITUDE_INCREASING_LONGITUDE = 3; - - private const STORAGE_ORDER_INCREASING_LONGITUDE_INCREASING_LATIITUDE = 4; - - private bool $coordinatesIncludedInData; - private int $valuesPerCoordinate; - private bool $precisionIncluded; - - private int $storageOrder; - private SplFixedArray $data; public function __construct($filename) { - parent::__construct($filename); + $this->gridFile = new SplFileObject($filename); - match ($this->getExtension()) { + match ($this->gridFile->getExtension()) { 'txt' => $this->initTxt(), 'mnt', 'tac' => $this->initMntOrTac(), }; @@ -77,10 +61,10 @@ private function initTxt(): void { $this->valuesPerCoordinate = 3; - $header0 = $this->fgets(); - $header1 = $this->fgets(); - $header2 = $this->fgets(); - $header3 = $this->fgets(); + $header0 = $this->gridFile->fgets(); + $header1 = $this->gridFile->fgets(); + $header2 = $this->gridFile->fgets(); + $header3 = $this->gridFile->fgets(); $interpolationMethod = trim(str_replace('GR3D2', '', $header2)); assert($interpolationMethod === 'INTERPOLATION BILINEAIRE'); @@ -98,20 +82,20 @@ private function initTxt(): void $this->data = new SplFixedArray($this->numberOfColumns * $this->numberOfRows); for ($i = 0, $numValues = $this->numberOfColumns * $this->numberOfRows; $i < $numValues; ++$i) { - $rowData = explode(' ', trim(preg_replace('/ +/', ' ', $this->fgets()))); + $rowData = explode(' ', trim(preg_replace('/ +/', ' ', $this->gridFile->fgets()))); $wantedData = array_slice($rowData, 3, 3); // ignore weird first fixed value, coordinates, precision and map sheet $wantedData = array_map(static function (string $value) {return (float) ($value); }, $wantedData); $this->data[$i] = $wantedData; } - $this->fgets(); - assert($this->eof()); + $this->gridFile->fgets(); + assert($this->gridFile->eof()); } private function initMntOrTac(): void { $fixedHeaderRegexp = '^(-?[\d.]+) (-?[\d.]+) (-?[\d.]+) (-?[\d.]+) ([\d.]+) ([\d.]+) ([1-4]) ([01]) (\d) ([01]) '; - $header = $this->fgets(); + $header = $this->gridFile->fgets(); preg_match('/' . $fixedHeaderRegexp . '/', $header, $fixedHeaderParts); @@ -124,9 +108,9 @@ private function initMntOrTac(): void $this->numberOfColumns = (int) (string) (($this->endX - $this->startX) / $this->columnGridInterval) + 1; $this->numberOfRows = (int) (string) (($this->endY - $this->startY) / $this->rowGridInterval) + 1; $this->storageOrder = (int) $fixedHeaderParts[7]; - $this->coordinatesIncludedInData = (bool) $fixedHeaderParts[8]; + $coordinatesIncludedInData = (bool) $fixedHeaderParts[8]; $this->valuesPerCoordinate = (int) $fixedHeaderParts[9]; - $this->precisionIncluded = (bool) $fixedHeaderParts[10]; + $precisionIncluded = (bool) $fixedHeaderParts[10]; preg_match('/' . $fixedHeaderRegexp . str_repeat('(-?[\d.]+) ', $this->valuesPerCoordinate) . '(.*)$/', $header, $fullHeaderParts); @@ -140,12 +124,12 @@ private function initMntOrTac(): void $this->data = new SplFixedArray($this->numberOfColumns * $this->numberOfRows); - $rawData = $this->fread($this->getSize() - strlen($header)); + $rawData = $this->gridFile->fread($this->gridFile->getSize() - strlen($header)); $values = explode(' ', trim(preg_replace('/\s+/', ' ', $rawData))); $cursor = 0; for ($i = 0, $numValues = $this->numberOfColumns * $this->numberOfRows; $i < $numValues; ++$i) { - if ($this->coordinatesIncludedInData) { + if ($coordinatesIncludedInData) { $cursor += 2; } @@ -157,12 +141,12 @@ private function initMntOrTac(): void $this->data[$i] = $rowData; - if ($this->precisionIncluded) { + if ($precisionIncluded) { ++$cursor; } } - $this->fgets(); - assert($this->eof()); + $this->gridFile->fgets(); + assert($this->gridFile->eof()); } } diff --git a/src/CoordinateOperation/IGNFHeightGrid.php b/src/CoordinateOperation/IGNFHeightGrid.php index 65b13a917..3903d186c 100644 --- a/src/CoordinateOperation/IGNFHeightGrid.php +++ b/src/CoordinateOperation/IGNFHeightGrid.php @@ -8,19 +8,19 @@ namespace PHPCoord\CoordinateOperation; -use PHPCoord\GeographicPoint; use PHPCoord\UnitOfMeasure\Length\Metre; -class IGNFHeightGrid extends IGNFGrid +class IGNFHeightGrid extends GeographicGeoidHeightGrid { - private const ITERATION_CONVERGENCE = 0.0001; + use IGNFGrid; - public function getAdjustment(GeographicPoint $point): Metre + /** + * @return Metre[] + */ + public function getValues(float $x, float $y): array { - $latitude = $point->getLatitude()->getValue(); - $longitude = $point->getLongitude()->getValue(); - $offset = $this->interpolateBilinear($longitude, $latitude)[0]; + $shift = $this->interpolate($x, $y)[0]; - return new Metre($offset); + return [new Metre($shift)]; } } diff --git a/src/CoordinateOperation/NADCON5Grid.php b/src/CoordinateOperation/NADCON5Grid.php index 422ce3801..c4b4e6c53 100644 --- a/src/CoordinateOperation/NADCON5Grid.php +++ b/src/CoordinateOperation/NADCON5Grid.php @@ -8,12 +8,11 @@ namespace PHPCoord\CoordinateOperation; -use PHPCoord\GeographicPoint; use SplFileObject; use UnexpectedValueException; use function unpack; -class NADCON5Grid extends SplFileObject +class NADCON5Grid extends Grid { use BiquadraticInterpolation; @@ -21,7 +20,7 @@ class NADCON5Grid extends SplFileObject public function __construct($filename) { - parent::__construct($filename); + $this->gridFile = new SplFileObject($filename); $header = $this->getHeader(); $this->startX = $header['xlonsw']; @@ -37,118 +36,38 @@ public function __construct($filename) }; } - public function getForwardAdjustment(GeographicPoint $point): float - { - return $this->getAdjustment($point->getLatitude()->asDegrees()->getValue(), $point->getLongitude()->asDegrees()->getValue()); - } - - /** - * Converted from NOAA FORTRAN. - */ - private function getAdjustment(float $latitude, float $longitude): float - { - if ($longitude < 0) { - $longitude += 360; // NADCON5 uses 0 = 360 = Greenwich - } - - // Method: - // Fit a 3x3 window over the random point. The closest - // 2x2 points will surround the point. But based on which - // quadrant of that 2x2 cell in which the point falls, the - // 3x3 window could extend NW, NE, SW or SE from the 2x2 cell. - - // Find which column should be LEAST when fitting - // a 3x3 window around $longitude. - $diflo = ($longitude - $this->startX); - $ratlo = $diflo / ($this->columnGridInterval / 2); - $ilo = (int) ($ratlo) + 1; - if ($ilo % 2 != 0) { - $xIndex = ($ilo + 1) / 2 - 1; - } else { - $xIndex = ($ilo) / 2; - } - - // Fix any edge overlaps - if ($xIndex < 1) { - $xIndex = 1; - } - if ($xIndex > $this->numberOfColumns - 2) { - $xIndex = $this->numberOfColumns - 2; - } - - // Find which row should be LEAST when fitting - // a 3x3 window around $latitude. - $difla = ($latitude - $this->startY); - $ratla = $difla / ($this->rowGridInterval / 2); - $ila = (int) ($ratla) + 1; - if ($ila % 2 != 0) { - $yIndex = ($ila + 1) / 2 - 1; - } else { - $yIndex = ($ila) / 2; - } - - // Fix any edge overlaps - if ($yIndex < 1) { - $yIndex = 1; - } - if ($yIndex > $this->numberOfRows - 2) { - $yIndex = $this->numberOfRows - 2; - } - - // In the range of 0(westernmost) to - // 2(easternmost) col, where is our - // random lon value? That is, x must - // be real and fall between 0 and 2. - $x = ($longitude - $this->columnGridInterval * ($xIndex - 1) - $this->startX) / $this->columnGridInterval; - - // In the range of 0(southernmost) to - // 2(northernmost) row, where is our - // random lat value? That is, x must - // be real and fall between 0 and 2. - $y = ($latitude - $this->rowGridInterval * ($yIndex - 1) - $this->startY) / $this->rowGridInterval; - - $corners = [ - 'lowerLeft' => $this->getRecord($xIndex, $yIndex), - 'lowerCentre' => $this->getRecord($xIndex + 1, $yIndex), - 'lowerRight' => $this->getRecord($xIndex + 2, $yIndex), - 'middleLeft' => $this->getRecord($xIndex, $yIndex + 1), - 'middleCentre' => $this->getRecord($xIndex + 1, $yIndex + 1), - 'middleRight' => $this->getRecord($xIndex + 2, $yIndex + 1), - 'upperLeft' => $this->getRecord($xIndex, $yIndex + 2), - 'upperCentre' => $this->getRecord($xIndex + 1, $yIndex + 2), - 'upperRight' => $this->getRecord($xIndex + 2, $yIndex + 2), - ]; - - //Interpolate value at lower row - $y0 = $this->interpolateQuadratic($x, $corners['lowerLeft'], $corners['lowerCentre'], $corners['lowerRight']); - //Interpolate value at middle row - $y1 = $this->interpolateQuadratic($x, $corners['middleLeft'], $corners['middleCentre'], $corners['middleRight']); - //Interpolate value at upper row - $y2 = $this->interpolateQuadratic($x, $corners['upperLeft'], $corners['upperCentre'], $corners['upperRight']); - - //Interpolate between rows - return $this->interpolateQuadratic($y, $y0, $y1, $y2); - } - - public function getRecord(int $longitudeIndex, int $latitudeIndex): float + protected function getRecord(int $longitudeIndex, int $latitudeIndex): GridValues { $startBytes = 52; $dataTypeBytes = $this->gridDataType === 'n' ? 2 : 4; $recordLength = 4 + $this->numberOfColumns * $dataTypeBytes + 4; - $this->fseek($startBytes + $recordLength * ($latitudeIndex - 1)); - $rawRow = $this->fread($recordLength); + $this->gridFile->fseek($startBytes + $recordLength * $latitudeIndex); + $rawRow = $this->gridFile->fread($recordLength); $row = unpack("Gstartbuffer/{$this->gridDataType}{$this->numberOfColumns}lon/Gendbuffer", $rawRow); - return $row['lon' . ($longitudeIndex)]; + return new GridValues( + $longitudeIndex * $this->columnGridInterval + $this->startX, + $latitudeIndex * $this->rowGridInterval + $this->startY, + [$row['lon' . ($longitudeIndex + 1)]] + ); } private function getHeader(): array { - $this->fseek(0); - $rawData = $this->fread(52); + $this->gridFile->fseek(0); + $rawData = $this->gridFile->fread(52); $data = unpack('Gstartbuffer/Exlatsw/Exlonsw/Edlat/Edlon/Nnlat/Nnlon/Nikind/Gendbuffer/', $rawData); return $data; } + + public function getValues(float $x, float $y): array + { + if ($x < 0) { + $x += 360; // NADCON5 uses 0 = 360 = Greenwich + } + + return $this->interpolate($x, $y); + } } diff --git a/src/CoordinateOperation/NADCON5Grids.php b/src/CoordinateOperation/NADCON5Grids.php new file mode 100644 index 000000000..bb6052271 --- /dev/null +++ b/src/CoordinateOperation/NADCON5Grids.php @@ -0,0 +1,35 @@ +longitudeGrid = $longitudeGrid; + $this->latitudeGrid = $latitudeGrid; + $this->ellipsoidHeightGrid = $ellipsoidHeightGrid; + } + + public function getValues(float $x, float $y): array + { + $latitudeShift = new ArcSecond($this->latitudeGrid->getValues($x, $y)[0]); + $longitudeShift = new ArcSecond($this->longitudeGrid->getValues($x, $y)[0]); + $heightShift = $this->ellipsoidHeightGrid ? new Metre($this->ellipsoidHeightGrid->getValues($x, $y)[0]) : null; + + return [$latitudeShift, $longitudeShift, $heightShift]; + } +} diff --git a/src/CoordinateOperation/NTv2Grid.php b/src/CoordinateOperation/NTv2Grid.php index 49a07e848..2a57c5e9f 100644 --- a/src/CoordinateOperation/NTv2Grid.php +++ b/src/CoordinateOperation/NTv2Grid.php @@ -8,21 +8,16 @@ namespace PHPCoord\CoordinateOperation; -use function abs; use function assert; -use PHPCoord\CoordinateReferenceSystem\Geographic; -use PHPCoord\GeographicPoint; -use PHPCoord\UnitOfMeasure\Angle\Angle; use PHPCoord\UnitOfMeasure\Angle\ArcSecond; use function round; use SplFileObject; use function unpack; use function usort; -class NTv2Grid extends SplFileObject +class NTv2Grid extends GeographicGrid { private const RECORD_SIZE = 16; - private const ITERATION_CONVERGENCE = 0.0001; private const FLAG_WITHIN_LIMITS = 1; private const FLAG_ON_UPPER_LATITUDE = 2; private const FLAG_ON_UPPER_LONGITUDE = 3; @@ -36,58 +31,33 @@ class NTv2Grid extends SplFileObject public function __construct($filename) { - parent::__construct($filename); + $this->gridFile = new SplFileObject($filename); + $this->storageOrder = self::STORAGE_ORDER_INCREASING_LATITUDE_INCREASING_LONGITUDE; $this->readHeader(); } - public function applyForwardAdjustment(GeographicPoint $point, Geographic $to): GeographicPoint - { - $adjustment = $this->getAdjustment($point->getLatitude(), $point->getLongitude()); - - $latitude = $point->getLatitude()->add($adjustment[0]); - $longitude = $point->getLongitude()->add($adjustment[1]); - - return GeographicPoint::create($latitude, $longitude, $point->getHeight(), $to, $point->getCoordinateEpoch()); - } - - public function applyReverseAdjustment(GeographicPoint $point, Geographic $to): GeographicPoint - { - $adjustment = [new ArcSecond(0), new ArcSecond(0)]; - $latitude = $point->getLatitude(); - $longitude = $point->getLongitude(); - - do { - $prevAdjustment = $adjustment; - $adjustment = $this->getAdjustment($latitude, $longitude); - $latitude = $point->getLatitude()->subtract($adjustment[0]); - $longitude = $point->getLongitude()->subtract($adjustment[1]); - } while (abs($adjustment[0]->subtract($prevAdjustment[0])->getValue()) > self::ITERATION_CONVERGENCE && abs($adjustment[1]->subtract($prevAdjustment[1])->getValue()) > self::ITERATION_CONVERGENCE); - - return GeographicPoint::create($latitude, $longitude, $point->getHeight(), $to, $point->getCoordinateEpoch()); - } - /** * @return ArcSecond[] */ - private function getAdjustment(Angle $latitude, Angle $longitude): array + public function getValues(float $x, float $y): array { // NTv2 is longitude positive *west* - $longitude = $longitude->multiply(-1); + $x *= -1; - $latitudeAsSeconds = Angle::convert($latitude, Angle::EPSG_ARC_SECOND)->getValue(); - $longitudeAsSeconds = Angle::convert($longitude, Angle::EPSG_ARC_SECOND)->getValue(); - $gridToUse = $this->determineBestGrid($latitudeAsSeconds, $longitudeAsSeconds); + // NTv2 is in seconds, not degrees + $x *= 3600; + $y *= 3600; - $offsets = $gridToUse->interpolateBilinear($longitudeAsSeconds, $latitudeAsSeconds); + $gridToUse = $this->determineBestGrid($x, $y); - return [new ArcSecond($offsets[0]), new ArcSecond(-$offsets[1])]; // NTv2 is longitude positive *west* + return $gridToUse->getValues($x, $y); } private function readHeader(): void { - $this->fseek(0); - $rawData = $this->fread(11 * self::RECORD_SIZE); + $this->gridFile->fseek(0); + $rawData = $this->gridFile->fread(11 * self::RECORD_SIZE); if (unpack('VNUM_OREC', $rawData, 8)['NUM_OREC'] !== 11) { $this->integerFormatChar = 'N'; $this->doubleFormatChar = 'E'; @@ -100,8 +70,8 @@ private function readHeader(): void $subFileStart = 11 * self::RECORD_SIZE; for ($i = 0; $i < $data['NUM_FILE']; ++$i) { - $this->fseek($subFileStart); - $subFileRawData = $this->fread(11 * self::RECORD_SIZE); + $this->gridFile->fseek($subFileStart); + $subFileRawData = $this->gridFile->fread(11 * self::RECORD_SIZE); $subFileData = unpack("A8/A8SUB_NAME/A8/A8PARENT/A8/A8CREATED/A8/A8UPDATED/A8/{$this->doubleFormatChar}S_LAT/A8/{$this->doubleFormatChar}N_LAT/A8/{$this->doubleFormatChar}E_LONG/A8/{$this->doubleFormatChar}W_LONG/A8/{$this->doubleFormatChar}LAT_INC/A8/{$this->doubleFormatChar}LONG_INC/A8/{$this->integerFormatChar}GS_COUNT/x4", $subFileRawData); $subFileData['offsetStart'] = $subFileStart; @@ -116,7 +86,7 @@ private function readHeader(): void } } - private function determineBestGrid(float $latitude, float $longitude): NTv2SubGrid + private function determineBestGrid(float $longitude, float $latitude): NTv2SubGrid { $possibleGrids = []; foreach ($this->subFileMetaData as $subFileMetaDatum) { @@ -138,7 +108,7 @@ private function determineBestGrid(float $latitude, float $longitude): NTv2SubGr $gridToUse = $possibleGrids[0][1]; return new NTv2SubGrid( - $this->getPathname(), + $this->gridFile->getPathname(), $gridToUse['offsetStart'], $gridToUse['S_LAT'], $gridToUse['N_LAT'], diff --git a/src/CoordinateOperation/NTv2SubGrid.php b/src/CoordinateOperation/NTv2SubGrid.php index 1feec5d59..c36ce0690 100644 --- a/src/CoordinateOperation/NTv2SubGrid.php +++ b/src/CoordinateOperation/NTv2SubGrid.php @@ -8,10 +8,11 @@ namespace PHPCoord\CoordinateOperation; +use PHPCoord\UnitOfMeasure\Angle\ArcSecond; use SplFileObject; use function unpack; -class NTv2SubGrid extends SplFileObject +class NTv2SubGrid extends Grid { use BilinearInterpolation; @@ -31,7 +32,7 @@ public function __construct( float $longitudeInterval, string $floatFormatChar ) { - parent::__construct($filename); + $this->gridFile = new SplFileObject($filename); $this->offsetStart = $offsetStart; $this->startX = $minLongitude; $this->endX = $maxLongitude; @@ -44,12 +45,22 @@ public function __construct( $this->numberOfRows = (int) (($this->endY - $this->startY) / $this->rowGridInterval); } - public function getRecord(int $longitudeIndex, int $latitudeIndex): GridValues + /** + * @return ArcSecond[] + */ + public function getValues(float $x, float $y): array + { + $shifts = $this->interpolate($x, $y); + + return [new ArcSecond($shifts[0]), new ArcSecond(-$shifts[1])]; // NTv2 is longitude positive *west* + } + + protected function getRecord(int $longitudeIndex, int $latitudeIndex): GridValues { $recordIndex = $latitudeIndex * ($this->numberOfColumns + 1) + $longitudeIndex; $recordOffset = $this->offsetStart + ((11 + $recordIndex) * self::RECORD_SIZE); - $this->fseek($recordOffset); - $rawRecord = $this->fread(self::RECORD_SIZE); + $this->gridFile->fseek($recordOffset); + $rawRecord = $this->gridFile->fread(self::RECORD_SIZE); $shifts = unpack("{$this->floatFormatChar}LATITUDE_SHIFT/{$this->floatFormatChar}LONGITUDE_SHIFT/{$this->floatFormatChar}LATITUDE_ACCURACY/{$this->floatFormatChar}LONGITUDE_ACCURACY", $rawRecord); return new GridValues( diff --git a/src/CoordinateOperation/OSTNOSGM15Grid.php b/src/CoordinateOperation/OSTNOSGM15Grid.php index 067aa17b8..3264fe2eb 100644 --- a/src/CoordinateOperation/OSTNOSGM15Grid.php +++ b/src/CoordinateOperation/OSTNOSGM15Grid.php @@ -16,7 +16,7 @@ use PHPCoord\UnitOfMeasure\Length\Metre; use SplFileObject; -class OSTNOSGM15Grid extends SplFileObject +class OSTNOSGM15Grid extends Grid { use BilinearInterpolation; @@ -24,7 +24,7 @@ class OSTNOSGM15Grid extends SplFileObject public function __construct($filename) { - parent::__construct($filename); + $this->gridFile = new SplFileObject($filename); $this->startX = 0; $this->startY = 0; @@ -36,10 +36,10 @@ public function __construct($filename) public function applyForwardHorizontalAdjustment(ProjectedPoint $point): ProjectedPoint { - $adjustment = $this->getAdjustment($point->getEasting()->asMetres(), $point->getNorthing()->asMetres()); + $adjustment = $this->getValues($point->getEasting()->asMetres()->getValue(), $point->getNorthing()->asMetres()->getValue()); - $easting = $point->getEasting()->add(new Metre($adjustment[0])); - $northing = $point->getNorthing()->add(new Metre($adjustment[1])); + $easting = $point->getEasting()->add($adjustment[0]); + $northing = $point->getNorthing()->add($adjustment[1]); return ProjectedPoint::createFromEastingNorthing($easting, $northing, Projected::fromSRID(Projected::EPSG_OSGB36_BRITISH_NATIONAL_GRID), $point->getCoordinateEpoch()); } @@ -54,40 +54,43 @@ public function applyReverseHorizontalAdjustment(ProjectedPoint $point): Project $osgb36NationalGrid->getBoundingArea() ); - $adjustment = [0, 0]; + $adjustment = [new Metre(0), new Metre(0)]; $easting = $point->getEasting(); $northing = $point->getNorthing(); do { $prevAdjustment = $adjustment; - $adjustment = $this->getAdjustment($easting->asMetres(), $northing->asMetres()); - $easting = $point->getEasting()->subtract(new Metre($adjustment[0])); - $northing = $point->getNorthing()->subtract(new Metre($adjustment[1])); - } while (abs($adjustment[0] - $prevAdjustment[0]) > self::ITERATION_CONVERGENCE && abs($adjustment[1] - $prevAdjustment[1]) > self::ITERATION_CONVERGENCE); + $adjustment = $this->getValues($easting->asMetres()->getValue(), $northing->asMetres()->getValue()); + $easting = $point->getEasting()->subtract($adjustment[0]); + $northing = $point->getNorthing()->subtract($adjustment[1]); + } while (abs($adjustment[0]->subtract($prevAdjustment[0])->getValue()) > self::ITERATION_CONVERGENCE && abs($adjustment[1]->subtract($prevAdjustment[1])->getValue()) > self::ITERATION_CONVERGENCE); return ProjectedPoint::createFromEastingNorthing($easting, $northing, $etrs89NationalGrid, $point->getCoordinateEpoch()); } - public function getVerticalAdjustment(ProjectedPoint $point): Metre + public function getHeightAdjustment(ProjectedPoint $point): Metre { - $adjustment = $this->getAdjustment($point->getEasting()->asMetres(), $point->getNorthing()->asMetres()); + $adjustment = $this->getValues($point->getEasting()->asMetres()->getValue(), $point->getNorthing()->asMetres()->getValue()); - return new Metre($adjustment[2]); + return $adjustment[2]; } - private function getAdjustment(Metre $easting, Metre $northing): array + /** + * @return Metre[] + */ + public function getValues(float $x, float $y): array { - $offsets = $this->interpolateBilinear($easting->getValue(), $northing->getValue()); + $offsets = $this->interpolate($x, $y); - return $offsets; + return [new Metre($offsets[0]), new Metre($offsets[1]), new Metre($offsets[2])]; } private function getRecord(int $eastIndex, int $northIndex): GridValues { $record = $northIndex * 701 + $eastIndex + 1; - $this->seek($record); - $rawData = $this->fgetcsv(); + $this->gridFile->seek($record); + $rawData = $this->gridFile->fgetcsv(); return new GridValues((float) $rawData[1], (float) $rawData[2], [(float) $rawData[3], (float) $rawData[4], (float) $rawData[5]]); } diff --git a/src/EPSG/Import/EPSGCodegenFromDataImport.php b/src/EPSG/Import/EPSGCodegenFromDataImport.php index f597d5460..fda956223 100644 --- a/src/EPSG/Import/EPSGCodegenFromDataImport.php +++ b/src/EPSG/Import/EPSGCodegenFromDataImport.php @@ -1262,7 +1262,7 @@ public function generateDataCoordinateOperations(): void CASE WHEN pu.param_sign_reversal = 'Yes' THEN 1 ELSE 0 END AS reverses FROM epsg_coordoperationparamvalue pv JOIN epsg_coordoperationparamusage pu ON pv.coord_op_method_code = pu.coord_op_method_code AND pv.parameter_code = pu.parameter_code - JOIN epsg_coordoperationparam p ON pv.parameter_code = p.parameter_code + JOIN epsg_coordoperationparam p ON pv.parameter_code = p.parameter_code AND p.parameter_code NOT IN (1048, 1062) WHERE operation_code = '{$operation}' GROUP BY pv.coord_op_code, p.parameter_code ORDER BY pu.sort_order @@ -1271,7 +1271,7 @@ public function generateDataCoordinateOperations(): void $paramsResult = $this->sqlite->query($paramsSql); while ($paramsRow = $paramsResult->fetchArray(SQLITE3_ASSOC)) { unset($paramsRow['operation_code']); - $paramsRow['name'] = self::camelCase($paramsRow['name']); + $paramsRow['name'] = self::makeParamName($paramsRow['name']); $paramsRow['reverses'] = (bool) $paramsRow['reverses']; if (in_array($paramsRow['parameter_code'], [8659, 8660, 1037, 1048, 8661, 8662], true)) { $paramsRow['value'] = 'urn:ogc:def:crs:EPSG::' . $paramsRow['value']; @@ -1288,9 +1288,7 @@ public function generateDataCoordinateOperations(): void 'latitudeDifferenceFile', 'longitudeDifferenceFile', 'ellipsoidalHeightDifferenceFile', - 'latitudeAndLongitudeDifferenceFile', - 'geocentricTranslationFile', - 'verticalOffsetFile', + 'offsetsFile', ], true ) @@ -1461,13 +1459,17 @@ public function generateExtents(): void echo 'done' . PHP_EOL; } - protected static function camelCase(string $string): string + protected static function makeParamName(string $string): string { $string = str_replace([' ', '-', '(', ')', '"'], '', ucwords($string, ' -()"')); if (!preg_match('/^(EPSG|[ABC][uv\d])/', $string)) { $string = lcfirst($string); } + if (in_array($string, ['latitudeAndLongitudeDifferenceFile', 'geocentricTranslationFile', 'verticalOffsetFile'], true)) { + $string = 'offsetsFile'; + } + return $string; } } diff --git a/src/GeographicPoint.php b/src/GeographicPoint.php index 8e108c38e..f29532934 100644 --- a/src/GeographicPoint.php +++ b/src/GeographicPoint.php @@ -30,13 +30,11 @@ use PHPCoord\CoordinateOperation\ComplexNumber; use PHPCoord\CoordinateOperation\ConvertiblePoint; use PHPCoord\CoordinateOperation\GeocentricValue; +use PHPCoord\CoordinateOperation\GeographicGeoidHeightGrid; +use PHPCoord\CoordinateOperation\GeographicGrid; use PHPCoord\CoordinateOperation\GeographicValue; -use PHPCoord\CoordinateOperation\GTXGrid; -use PHPCoord\CoordinateOperation\IGNESHeightGrid; -use PHPCoord\CoordinateOperation\IGNFGeocentricTranslationGrid; -use PHPCoord\CoordinateOperation\IGNFHeightGrid; use PHPCoord\CoordinateOperation\NADCON5Grid; -use PHPCoord\CoordinateOperation\NTv2Grid; +use PHPCoord\CoordinateOperation\NADCON5Grids; use PHPCoord\CoordinateOperation\OSTNOSGM15Grid; use PHPCoord\CoordinateReferenceSystem\Compound; use PHPCoord\CoordinateReferenceSystem\Geocentric; @@ -2117,8 +2115,7 @@ public function OSTN15( */ public function geographic3DTo2DPlusGravityHeightOSGM15( Compound $to, - OSTNOSGM15Grid $geoidHeightCorrectionModelFile, - string $EPSGCodeForInterpolationCRS + OSTNOSGM15Grid $geoidHeightCorrectionModelFile ): CompoundPoint { $osgb36NationalGrid = Projected::fromSRID(Projected::EPSG_OSGB36_BRITISH_NATIONAL_GRID); $etrs89NationalGrid = new Projected( @@ -2139,7 +2136,7 @@ public function geographic3DTo2DPlusGravityHeightOSGM15( ); $verticalPoint = VerticalPoint::create( - $this->height->subtract($geoidHeightCorrectionModelFile->getVerticalAdjustment($projected)), + $this->height->subtract($geoidHeightCorrectionModelFile->getHeightAdjustment($projected)), $to->getVertical(), $this->getCoordinateEpoch() ); @@ -2172,93 +2169,18 @@ public function geographic3DToGravityHeightOSGM15( $projected = $this->transverseMercator($etrs89NationalGrid, new Degree(49), new Degree(-2), new Unity(0.9996012717), new Metre(400000), new Metre(-100000)); return VerticalPoint::create( - $this->height->subtract($geoidHeightCorrectionModelFile->getVerticalAdjustment($projected)), - $to, - $this->getCoordinateEpoch() - ); - } - - /** - * Geog3D to Geog2D+GravityRelatedHeight (gtx). - */ - public function geographic3DTo2DPlusGravityHeightGTX( - Compound $to, - GTXGrid $geoidHeightCorrectionModelFile, - string $EPSGCodeForInterpolationCRS - ): CompoundPoint { - $horizontalPoint = self::create( - $this->latitude, - $this->longitude, - null, - $to->getHorizontal(), - $this->getCoordinateEpoch() - ); - - $verticalPoint = VerticalPoint::create( - $this->height->subtract($geoidHeightCorrectionModelFile->getAdjustment($this)), - $to->getVertical(), - $this->getCoordinateEpoch() - ); - - return CompoundPoint::create( - $horizontalPoint, - $verticalPoint, - $to, - $this->getCoordinateEpoch() - ); - } - - /** - * Geographic3D to GravityRelatedHeight (gtx). - */ - public function geographic3DToGravityHeightGTX( - Vertical $to, - GTXGrid $geoidHeightCorrectionModelFile - ): VerticalPoint { - return VerticalPoint::create( - $this->height->subtract($geoidHeightCorrectionModelFile->getAdjustment($this)), - $to, - $this->getCoordinateEpoch() - ); - } - - /** - * Geog3D to Geog2D+GravityRelatedHeight (IGNES). - */ - public function geographic3DTo2DPlusGravityHeightIGNES( - Compound $to, - IGNESHeightGrid $geoidHeightCorrectionModelFile, - string $EPSGCodeForInterpolationCRS - ): CompoundPoint { - $horizontalPoint = self::create( - $this->latitude, - $this->longitude, - null, - $to->getHorizontal(), - $this->getCoordinateEpoch() - ); - - $verticalPoint = VerticalPoint::create( - $this->height->subtract($geoidHeightCorrectionModelFile->getAdjustment($this)), - $to->getVertical(), - $this->getCoordinateEpoch() - ); - - return CompoundPoint::create( - $horizontalPoint, - $verticalPoint, + $this->height->subtract($geoidHeightCorrectionModelFile->getHeightAdjustment($projected)), $to, $this->getCoordinateEpoch() ); } /** - * Geog3D to Geog2D+GravityRelatedHeight (IGNF). + * Geog3D to Geog2D+GravityRelatedHeight. */ - public function geographic3DTo2DPlusGravityHeightIGNF( + public function geographic3DTo2DPlusGravityHeightFromGrid( Compound $to, - IGNFHeightGrid $geoidHeightCorrectionModelFile, - string $EPSGCodeForInterpolationCRS + GeographicGeoidHeightGrid $geoidHeightCorrectionModelFile ): CompoundPoint { $horizontalPoint = self::create( $this->latitude, @@ -2269,7 +2191,7 @@ public function geographic3DTo2DPlusGravityHeightIGNF( ); $verticalPoint = VerticalPoint::create( - $this->height->subtract($geoidHeightCorrectionModelFile->getAdjustment($this)), + $this->height->subtract($geoidHeightCorrectionModelFile->getHeightAdjustment($this)), $to->getVertical(), $this->getCoordinateEpoch() ); @@ -2283,28 +2205,14 @@ public function geographic3DTo2DPlusGravityHeightIGNF( } /** - * Geographic3D to GravityRelatedHeight (IGNES). + * Geographic3D to GravityRelatedHeight. */ - public function geographic3DToGravityHeightIGNES( + public function geographic3DToGravityHeightFromGrid( Vertical $to, - IGNESHeightGrid $geoidHeightCorrectionModelFile + GeographicGeoidHeightGrid $geoidHeightCorrectionModelFile ): VerticalPoint { return VerticalPoint::create( - $this->height->subtract($geoidHeightCorrectionModelFile->getAdjustment($this)), - $to, - $this->getCoordinateEpoch() - ); - } - - /** - * Geographic3D to GravityRelatedHeight (IGNF). - */ - public function geographic3DToGravityHeightIGNF( - Vertical $to, - IGNFHeightGrid $geoidHeightCorrectionModelFile - ): VerticalPoint { - return VerticalPoint::create( - $this->height->subtract($geoidHeightCorrectionModelFile->getAdjustment($this)), + $this->height->subtract($geoidHeightCorrectionModelFile->getHeightAdjustment($this)), $to, $this->getCoordinateEpoch() ); @@ -2312,74 +2220,33 @@ public function geographic3DToGravityHeightIGNF( /** * NADCON5. - * Geodetic transformation operating on geographic coordinate differences by bi-quadratic interpolation. Input - * expects longitudes to be positive east in range 0-360° (0° = Greenwich). + * @internal just a wrapper */ - public function NADCON5( + public function offsetsFromGridNADCON5( Geographic $to, NADCON5Grid $latitudeDifferenceFile, NADCON5Grid $longitudeDifferenceFile, ?NADCON5Grid $ellipsoidalHeightDifferenceFile, bool $inReverse ): self { - /* - * Ideally most of this logic (especially reverse case) would be in the NADCON5Grid class like the other grids, - * but NADCON5 uses different files for latitude/longitude/height that need to be combined at runtime so that - * isn't possible. - */ - if (!$inReverse) { - $latitudeAdjustment = new ArcSecond($latitudeDifferenceFile->getForwardAdjustment($this)); - $longitudeAdjustment = new ArcSecond($longitudeDifferenceFile->getForwardAdjustment($this)); - $heightAdjustment = $this->getHeight() && $ellipsoidalHeightDifferenceFile ? new Metre($ellipsoidalHeightDifferenceFile->getForwardAdjustment($this)) : null; - - return self::create($this->latitude->add($latitudeAdjustment), $this->longitude->add($longitudeAdjustment), $heightAdjustment ? $this->height->add($heightAdjustment) : null, $to, $this->getCoordinateEpoch()); - } - - $iteration = $this; - - do { - $prevIteration = $iteration; - $latitudeAdjustment = new ArcSecond($latitudeDifferenceFile->getForwardAdjustment($iteration)); - $longitudeAdjustment = new ArcSecond($longitudeDifferenceFile->getForwardAdjustment($iteration)); - $heightAdjustment = $this->getHeight() && $ellipsoidalHeightDifferenceFile ? new Metre($ellipsoidalHeightDifferenceFile->getForwardAdjustment($iteration)) : null; - $iteration = self::create($this->latitude->subtract($latitudeAdjustment), $this->longitude->subtract($longitudeAdjustment), $heightAdjustment ? $this->height->subtract($heightAdjustment) : null, $to, $this->getCoordinateEpoch()); - } while (abs($iteration->latitude->subtract($prevIteration->latitude)->getValue()) > self::ITERATION_CONVERGENCE_GRID && abs($iteration->longitude->subtract($prevIteration->longitude)->getValue()) > self::ITERATION_CONVERGENCE_GRID && ($this->height === null || abs($iteration->height->subtract($prevIteration->height)->getValue()) > self::ITERATION_CONVERGENCE_GRID)); - - return $iteration; - } - - /** - * NTv2 - * Geodetic transformation operating on geographic coordinate differences by bi-linear interpolation. Supersedes - * NTv1 (transformation method code 9614). Input expects longitudes to be positive west. - */ - public function NTv2( - Geographic $to, - NTv2Grid $latitudeAndLongitudeDifferenceFile, - bool $inReverse - ): self { - if (!$inReverse) { - return $latitudeAndLongitudeDifferenceFile->applyForwardAdjustment($this, $to); - } + $aggregation = new NADCON5Grids($longitudeDifferenceFile, $latitudeDifferenceFile, $ellipsoidalHeightDifferenceFile); - return $latitudeAndLongitudeDifferenceFile->applyReverseAdjustment($this, $to); + return $this->offsetsFromGrid($to, $aggregation, $inReverse); } /** - * Geocentric translation by Grid Interpolation (IGN France). + * Geographic offsets from grid. */ - public function geocentricTranslationByGridInterpolationIGNF( + public function offsetsFromGrid( Geographic $to, - IGNFGeocentricTranslationGrid $geocentricTranslationFile, - string $EPSGCodeForInterpolationCRS, - string $EPSGCodeForStandardCT, + GeographicGrid $offsetsFile, bool $inReverse ): self { if (!$inReverse) { - return $geocentricTranslationFile->applyForwardAdjustment($this, $to); + return $offsetsFile->applyForwardAdjustment($this, $to); } - return $geocentricTranslationFile->applyReverseAdjustment($this, $to); + return $offsetsFile->applyReverseAdjustment($this, $to); } public function asGeographicValue(): GeographicValue diff --git a/src/VerticalPoint.php b/src/VerticalPoint.php index e24305734..3872f1e3d 100644 --- a/src/VerticalPoint.php +++ b/src/VerticalPoint.php @@ -13,7 +13,7 @@ use DateTime; use DateTimeImmutable; use DateTimeInterface; -use PHPCoord\CoordinateOperation\GTXGrid; +use PHPCoord\CoordinateOperation\GeographicGeoidHeightGrid; use PHPCoord\CoordinateReferenceSystem\Vertical; use PHPCoord\Exception\InvalidCoordinateReferenceSystemException; use PHPCoord\UnitOfMeasure\Angle\Angle; @@ -101,7 +101,7 @@ public function __toString(): string * This transformation allows calculation of height (or depth) in the target system by adding the parameter value * to the height (or depth)-value of the point in the source system. */ - public function verticalOffset( + public function offset( Vertical $to, Length $verticalOffset ): self { @@ -113,7 +113,7 @@ public function verticalOffset( * This transformation allows calculation of height in the target system by applying the parameter values to the * height value of the point in the source system. */ - public function verticalOffsetAndSlope( + public function offsetAndSlope( Vertical $to, Angle $ordinate1OfEvaluationPoint, Angle $ordinate2OfEvaluationPoint, @@ -181,21 +181,20 @@ public function zeroTideHeightToMeanTideHeightEVRF2019( } /** - * Vertical Offset by Grid Interpolation (gtx). + * Vertical Offset by Grid Interpolation. */ - public function verticalOffsetGTX( + public function offsetFromGrid( Vertical $to, - GTXGrid $verticalOffsetFile, - string $EPSGCodeForInterpolationCRS, + GeographicGeoidHeightGrid $offsetsFile, bool $inReverse, GeographicPoint $horizontalPoint ): self { - $delta = $verticalOffsetFile->getAdjustment($horizontalPoint); + $offset = $offsetsFile->getHeightAdjustment($horizontalPoint); if ($inReverse) { - $delta = $delta->multiply(-1); + $offset = $offset->multiply(-1); } - return static::create($this->height->add($delta), $to); + return static::create($this->height->add($offset), $to); } } diff --git a/tests/CompoundPointTest.php b/tests/CompoundPointTest.php index da8e251a1..265319032 100644 --- a/tests/CompoundPointTest.php +++ b/tests/CompoundPointTest.php @@ -8,7 +8,6 @@ namespace PHPCoord; -use PHPCoord\CoordinateOperation\IGNESHeightETRS89REDNAPSpainProvider; use function class_exists; use DateTime; use DateTimeImmutable; @@ -16,6 +15,7 @@ use PHPCoord\CoordinateOperation\CoordinateOperations; use PHPCoord\CoordinateOperation\CRSTransformations; use PHPCoord\CoordinateOperation\GTXNZGeoid2016Provider; +use PHPCoord\CoordinateOperation\IGNESHeightETRS89REDNAPSpainProvider; use PHPCoord\CoordinateOperation\IGNFHeightRGF93v2bNGFIGN69FranceProvider; use PHPCoord\CoordinateOperation\OSTN15OSGM15Provider; use PHPCoord\CoordinateReferenceSystem\Compound; @@ -159,7 +159,7 @@ public function testGeographic3DTo2DPlusGravityHeightGTX(): void Compound::fromSRID(Compound::EPSG_NZGD2000_PLUS_NZVD2016_HEIGHT) ); $toCRS = Geographic3D::fromSRID(Geographic3D::EPSG_NZGD2000); - $to = $from->geographic3DTo2DPlusGravityHeightGTX($toCRS, (new GTXNZGeoid2016Provider())->provideGrid(), ''); + $to = $from->geographic3DTo2DPlusGravityHeightFromGrid($toCRS, (new GTXNZGeoid2016Provider())->provideGrid()); self::assertEqualsWithDelta(-36.9003, $to->getLatitude()->getValue(), 0.00000000001); self::assertEqualsWithDelta(174.7794, $to->getLongitude()->getValue(), 0.00000000001); @@ -185,7 +185,7 @@ public function testGeographic3DTo2DPlusGravityHeightIGNF(): void Compound::fromSRID(Compound::EPSG_RGF93_V2B_PLUS_NGF_IGN69_HEIGHT) ); $toCRS = Geographic3D::fromSRID(Geographic3D::EPSG_RGF93_V2B); - $to = $from->geographic3DTo2DPlusGravityHeightIGNF($toCRS, (new IGNFHeightRGF93v2bNGFIGN69FranceProvider())->provideGrid(), ''); + $to = $from->geographic3DTo2DPlusGravityHeightFromGrid($toCRS, (new IGNFHeightRGF93v2bNGFIGN69FranceProvider())->provideGrid()); self::assertEqualsWithDelta(48.858222, $to->getLatitude()->getValue(), 0.00000000001); self::assertEqualsWithDelta(2.2945, $to->getLongitude()->getValue(), 0.00000000001); @@ -211,7 +211,7 @@ public function testGeographic3DTo2DPlusGravityHeightIGNESSpain(): void Compound::fromSRID(Compound::EPSG_ETRS89_PLUS_ALICANTE_HEIGHT) ); $toCRS = Geographic3D::fromSRID(Geographic3D::EPSG_ETRS89); - $to = $from->geographic3DTo2DPlusGravityHeightIGNES($toCRS, (new IGNESHeightETRS89REDNAPSpainProvider())->provideGrid(), ''); + $to = $from->geographic3DTo2DPlusGravityHeightFromGrid($toCRS, (new IGNESHeightETRS89REDNAPSpainProvider())->provideGrid()); self::assertEqualsWithDelta(41.403611, $to->getLatitude()->getValue(), 0.00000000001); self::assertEqualsWithDelta(2.174444, $to->getLongitude()->getValue(), 0.00000000001); diff --git a/tests/GeographicPoint3DTest.php b/tests/GeographicPoint3DTest.php index c10aeda01..4368776d7 100644 --- a/tests/GeographicPoint3DTest.php +++ b/tests/GeographicPoint3DTest.php @@ -68,7 +68,7 @@ public function testGeographic3DTo2DPlusGravityHeightGTXNZ(): void } $from = GeographicPoint::create(new Degree(-36.9003), new Degree(174.7794), new Metre(50), Geographic3D::fromSRID(Geographic3D::EPSG_NZGD2000)); $toCRS = Compound::fromSRID(Compound::EPSG_NZGD2000_PLUS_NZVD2016_HEIGHT); - $to = $from->geographic3DTo2DPlusGravityHeightGTX($toCRS, (new GTXNZGeoid2016Provider())->provideGrid(), ''); + $to = $from->geographic3DTo2DPlusGravityHeightFromGrid($toCRS, (new GTXNZGeoid2016Provider())->provideGrid()); self::assertEqualsWithDelta(-36.9003, $to->getHorizontalPoint()->getLatitude()->getValue(), 0.00000000001); self::assertEqualsWithDelta(174.7794, $to->getHorizontalPoint()->getLongitude()->getValue(), 0.00000000001); @@ -82,7 +82,7 @@ public function testGeographic3DGravityHeightGTXNZ(): void } $from = GeographicPoint::create(new Degree(-36.9003), new Degree(174.7794), new Metre(50), Geographic3D::fromSRID(Geographic3D::EPSG_NZGD2000)); $toCRS = Vertical::fromSRID(Vertical::EPSG_NZVD2016_HEIGHT); - $to = $from->geographic3DToGravityHeightGTX($toCRS, (new GTXNZGeoid2016Provider())->provideGrid()); + $to = $from->geographic3DToGravityHeightFromGrid($toCRS, (new GTXNZGeoid2016Provider())->provideGrid()); self::assertEqualsWithDelta(15.715, $to->getHeight()->getValue(), 0.0001); } @@ -94,7 +94,7 @@ public function testGeographic3DTo2DPlusGravityHeightGTXAustralia(): void } $from = GeographicPoint::create(new Degree(-36.9003), new Degree(144.7794), new Metre(50), Geographic3D::fromSRID(Geographic3D::EPSG_GDA2020)); $toCRS = Compound::fromSRID(Compound::EPSG_GDA2020_PLUS_AHD_HEIGHT); - $to = $from->geographic3DTo2DPlusGravityHeightGTX($toCRS, (new GTXGDA2020AHDProvider())->provideGrid(), ''); + $to = $from->geographic3DTo2DPlusGravityHeightFromGrid($toCRS, (new GTXGDA2020AHDProvider())->provideGrid()); self::assertEqualsWithDelta(-36.9003, $to->getHorizontalPoint()->getLatitude()->getValue(), 0.00000000001); self::assertEqualsWithDelta(144.7794, $to->getHorizontalPoint()->getLongitude()->getValue(), 0.00000000001); @@ -108,7 +108,7 @@ public function testGeographic3DTo2DPlusGravityHeightIGNFFrance(): void } $from = GeographicPoint::create(new Degree(48.858222), new Degree(2.2945), new Metre(50), Geographic3D::fromSRID(Geographic3D::EPSG_RGF93_V2B)); $toCRS = Compound::fromSRID(Compound::EPSG_RGF93_V2B_PLUS_NGF_IGN69_HEIGHT); - $to = $from->geographic3DTo2DPlusGravityHeightIGNF($toCRS, (new IGNFHeightRGF93v2bNGFIGN69FranceProvider())->provideGrid(), ''); + $to = $from->geographic3DTo2DPlusGravityHeightFromGrid($toCRS, (new IGNFHeightRGF93v2bNGFIGN69FranceProvider())->provideGrid()); self::assertEqualsWithDelta(48.858222, $to->getHorizontalPoint()->getLatitude()->getValue(), 0.00000000001); self::assertEqualsWithDelta(2.2945, $to->getHorizontalPoint()->getLongitude()->getValue(), 0.00000000001); @@ -117,12 +117,12 @@ public function testGeographic3DTo2DPlusGravityHeightIGNFFrance(): void public function testGeographic3DGravityHeightIGNFFrance(): void { - if (!class_exists(GTXNZGeoid2016Provider::class)) { + if (!class_exists(IGNFHeightRGF93v2bNGFIGN69FranceProvider::class)) { self::markTestSkipped('Requires phpcoord/datapack-europe'); } $from = GeographicPoint::create(new Degree(48.858222), new Degree(2.2945), new Metre(50), Geographic3D::fromSRID(Geographic3D::EPSG_RGF93_V2B)); $toCRS = Vertical::fromSRID(Vertical::EPSG_NGF_IGN69_HEIGHT); - $to = $from->geographic3DToGravityHeightIGNF($toCRS, (new IGNFHeightRGF93v2bNGFIGN69FranceProvider())->provideGrid()); + $to = $from->geographic3DToGravityHeightFromGrid($toCRS, (new IGNFHeightRGF93v2bNGFIGN69FranceProvider())->provideGrid()); self::assertEqualsWithDelta(6.187, $to->getHeight()->getValue(), 0.001); } @@ -134,7 +134,7 @@ public function testGeographic3DTo2DPlusGravityHeightIGNESSpain(): void } $from = GeographicPoint::create(new Degree(41.403611), new Degree(2.174444), new Metre(0), Geographic3D::fromSRID(Geographic3D::EPSG_ETRS89)); $toCRS = Compound::fromSRID(Compound::EPSG_ETRS89_PLUS_ALICANTE_HEIGHT); - $to = $from->geographic3DTo2DPlusGravityHeightIGNES($toCRS, (new IGNESHeightETRS89REDNAPSpainProvider())->provideGrid(), ''); + $to = $from->geographic3DTo2DPlusGravityHeightFromGrid($toCRS, (new IGNESHeightETRS89REDNAPSpainProvider())->provideGrid()); self::assertEqualsWithDelta(41.403611, $to->getHorizontalPoint()->getLatitude()->getValue(), 0.00000000001); self::assertEqualsWithDelta(2.174444, $to->getHorizontalPoint()->getLongitude()->getValue(), 0.00000000001); @@ -148,7 +148,7 @@ public function testGeographic3DGravityHeightIGNESSpain(): void } $from = GeographicPoint::create(new Degree(41.403611), new Degree(2.174444), new Metre(0), Geographic3D::fromSRID(Geographic3D::EPSG_ETRS89)); $toCRS = Vertical::fromSRID(Vertical::EPSG_ALICANTE_HEIGHT); - $to = $from->geographic3DToGravityHeightIGNES($toCRS, (new IGNESHeightETRS89REDNAPSpainProvider())->provideGrid()); + $to = $from->geographic3DToGravityHeightFromGrid($toCRS, (new IGNESHeightETRS89REDNAPSpainProvider())->provideGrid()); self::assertEqualsWithDelta(-49.196, $to->getHeight()->getValue(), 0.001); } diff --git a/tests/GeographicPointTest.php b/tests/GeographicPointTest.php index 02ccb0ab3..7bc995b9c 100644 --- a/tests/GeographicPointTest.php +++ b/tests/GeographicPointTest.php @@ -1051,7 +1051,7 @@ public function testNADCON5Forward3DTransform3DPoint(): void } $from = GeographicPoint::create(new Degree(43.7737469611), new Degree(-99.3189543667), new Metre(100), Geographic3D::fromSRID(Geographic3D::EPSG_NAD83_FBN)); $toCRS = Geographic3D::fromSRID(Geographic3D::EPSG_NAD83_NSRS2007); - $to = $from->NADCON5( + $to = $from->offsetsFromGridNADCON5( $toCRS, (new NADCON5NAD83FBNNAD832007CONUSLatitudeProvider())->provideGrid(), (new NADCON5NAD83FBNNAD832007CONUSLongitudeProvider())->provideGrid(), @@ -1071,7 +1071,7 @@ public function testNADCON5Reverse3DTransform3DPoint(): void } $from = GeographicPoint::create(new Degree(43.7737471044), new Degree(-99.3189544237), new Metre(100.005), Geographic3D::fromSRID(Geographic3D::EPSG_NAD83_FBN)); $toCRS = Geographic3D::fromSRID(Geographic3D::EPSG_NAD83_NSRS2007); - $to = $from->NADCON5( + $to = $from->offsetsFromGridNADCON5( $toCRS, (new NADCON5NAD83FBNNAD832007CONUSLatitudeProvider())->provideGrid(), (new NADCON5NAD83FBNNAD832007CONUSLongitudeProvider())->provideGrid(), @@ -1091,7 +1091,7 @@ public function testNADCON5Forward3DTransform2DPoint(): void } $from = GeographicPoint::create(new Degree(43.7737469611), new Degree(-99.3189543667), null, Geographic2D::fromSRID(Geographic2D::EPSG_NAD83_FBN)); $toCRS = Geographic2D::fromSRID(Geographic2D::EPSG_NAD83_NSRS2007); - $to = $from->NADCON5( + $to = $from->offsetsFromGridNADCON5( $toCRS, (new NADCON5NAD83FBNNAD832007CONUSLatitudeProvider())->provideGrid(), (new NADCON5NAD83FBNNAD832007CONUSLongitudeProvider())->provideGrid(), @@ -1111,7 +1111,7 @@ public function testNADCON5Reverse3DTransform2DPoint(): void } $from = GeographicPoint::create(new Degree(43.7737471044), new Degree(-99.3189544237), null, Geographic2D::fromSRID(Geographic2D::EPSG_NAD83_FBN)); $toCRS = Geographic2D::fromSRID(Geographic2D::EPSG_NAD83_NSRS2007); - $to = $from->NADCON5( + $to = $from->offsetsFromGridNADCON5( $toCRS, (new NADCON5NAD83FBNNAD832007CONUSLatitudeProvider())->provideGrid(), (new NADCON5NAD83FBNNAD832007CONUSLongitudeProvider())->provideGrid(), @@ -1131,7 +1131,7 @@ public function testNADCON5Forward2D(): void } $from = GeographicPoint::create(new Degree(40.689247), new Degree(-74.044502), null, Geographic2D::fromSRID(Geographic2D::EPSG_NAD27)); $toCRS = Geographic2D::fromSRID(Geographic2D::EPSG_NAD83); - $to = $from->NADCON5( + $to = $from->offsetsFromGridNADCON5( $toCRS, (new NADCON5NAD27NAD831986CONUSLatitudeProvider())->provideGrid(), (new NADCON5NAD27NAD831986CONUSLongitudeProvider())->provideGrid(), @@ -1151,7 +1151,7 @@ public function testNADCON5Reverse2D(): void } $from = GeographicPoint::create(new Degree(40.6893492339), new Degree(-74.0440875374), null, Geographic2D::fromSRID(Geographic2D::EPSG_NAD27)); $toCRS = Geographic2D::fromSRID(Geographic2D::EPSG_NAD83); - $to = $from->NADCON5( + $to = $from->offsetsFromGridNADCON5( $toCRS, (new NADCON5NAD27NAD831986CONUSLatitudeProvider())->provideGrid(), (new NADCON5NAD27NAD831986CONUSLongitudeProvider())->provideGrid(), @@ -1171,7 +1171,7 @@ public function testNTv2ForwardCanada(): void } $from = GeographicPoint::create(new Degree(50.8713458), new Degree(-114.2934808), null, Geographic2D::fromSRID(Geographic2D::EPSG_NAD27)); $toCRS = Geographic2D::fromSRID(Geographic2D::EPSG_NAD83); - $to = $from->NTv2( + $to = $from->offsetsFromGrid( $toCRS, (new NTv2NAD27NAD83CanadaProvider())->provideGrid(), false @@ -1189,7 +1189,7 @@ public function testNTv2ReverseCanada(): void } $from = GeographicPoint::create(new Degree(50.871401224), new Degree(-114.294481160), null, Geographic2D::fromSRID(Geographic2D::EPSG_NAD83)); $toCRS = Geographic2D::fromSRID(Geographic2D::EPSG_NAD27); - $to = $from->NTv2( + $to = $from->offsetsFromGrid( $toCRS, (new NTv2NAD27NAD83CanadaProvider())->provideGrid(), true @@ -1207,7 +1207,7 @@ public function testNTv2ForwardAustralia(): void } $from = GeographicPoint::create(new Degree(-29.05000000), new Degree(120.84722222), null, Geographic2D::fromSRID(Geographic2D::EPSG_AGD66)); $toCRS = Geographic2D::fromSRID(Geographic2D::EPSG_GDA94); - $to = $from->NTv2( + $to = $from->offsetsFromGrid( $toCRS, (new NTv2AGD66GDA94AustraliaProvider())->provideGrid(), false @@ -1225,7 +1225,7 @@ public function testNTv2ReverseAustralia(): void } $from = GeographicPoint::create(new Degree(-29.04869025), new Degree(120.84864381), null, Geographic2D::fromSRID(Geographic2D::EPSG_AGD66)); $toCRS = Geographic2D::fromSRID(Geographic2D::EPSG_GDA94); - $to = $from->NTv2( + $to = $from->offsetsFromGrid( $toCRS, (new NTv2AGD66GDA94AustraliaProvider())->provideGrid(), true @@ -1243,11 +1243,9 @@ public function testIGNFGeocentricTranslationFranceForward(): void } $from = GeographicPoint::create(new Degree(48.84451225), new Degree(2.42567186), null, Geographic2D::fromSRID(Geographic2D::EPSG_NTF)); $toCRS = Geographic2D::fromSRID(Geographic2D::EPSG_RGF93_V1); - $to = $from->geocentricTranslationByGridInterpolationIGNF( + $to = $from->offsetsFromGrid( $toCRS, (new IGNFGeocentricTranslationNTFRGF93Provider())->provideGrid(), - '', - '', false ); @@ -1263,11 +1261,9 @@ public function testIGNFGeocentricTranslationFranceReverse(): void } $from = GeographicPoint::create(new Degree(48.844445839), new Degree(2.424971108), null, Geographic2D::fromSRID(Geographic2D::EPSG_RGF93_V1)); $toCRS = Geographic2D::fromSRID(Geographic2D::EPSG_NTF); - $to = $from->geocentricTranslationByGridInterpolationIGNF( + $to = $from->offsetsFromGrid( $toCRS, (new IGNFGeocentricTranslationNTFRGF93Provider())->provideGrid(), - '', - '', true ); @@ -1283,11 +1279,9 @@ public function testIGNFGeocentricTranslationNoumeaForward(): void } $from = GeographicPoint::create(new Degree(-22.268889), new Degree(166.419444), null, Geographic2D::fromSRID(Geographic2D::EPSG_NEA74_NOUMEA)); $toCRS = Geographic2D::fromSRID(Geographic2D::EPSG_RGNC91_93); - $to = $from->geocentricTranslationByGridInterpolationIGNF( + $to = $from->offsetsFromGrid( $toCRS, (new IGNFGeocentricTranslationNEA74NoumeaRGNC9193Provider())->provideGrid(), - '', - '', false ); @@ -1303,11 +1297,9 @@ public function testIGNFGeocentricTranslationNoumeaReverse(): void } $from = GeographicPoint::create(new Degree(-22.26612898), new Degree(166.42277652), null, Geographic2D::fromSRID(Geographic2D::EPSG_RGNC91_93)); $toCRS = Geographic2D::fromSRID(Geographic2D::EPSG_NEA74_NOUMEA); - $to = $from->geocentricTranslationByGridInterpolationIGNF( + $to = $from->offsetsFromGrid( $toCRS, (new IGNFGeocentricTranslationNEA74NoumeaRGNC9193Provider())->provideGrid(), - '', - '', true ); @@ -1323,11 +1315,9 @@ public function testIGNFGeocentricTranslationGrandeTerreForward(): void } $from = GeographicPoint::create(new Degree(-22.268889), new Degree(166.419444), null, Geographic2D::fromSRID(Geographic2D::EPSG_IGN72_GRANDE_TERRE)); $toCRS = Geographic2D::fromSRID(Geographic2D::EPSG_RGNC91_93); - $to = $from->geocentricTranslationByGridInterpolationIGNF( + $to = $from->offsetsFromGrid( $toCRS, (new IGNFGeocentricTranslationIGN72GrandeTerreRGNC9193Provider())->provideGrid(), - '', - '', false ); diff --git a/tests/VerticalPointTest.php b/tests/VerticalPointTest.php index 40f2e5246..d09eb3fca 100644 --- a/tests/VerticalPointTest.php +++ b/tests/VerticalPointTest.php @@ -75,7 +75,7 @@ public function testVerticalOffset(): void { $from = VerticalPoint::create(new Metre(2.55), Vertical::fromSRID(Vertical::EPSG_BALTIC_1977_HEIGHT)); $toCRS = Vertical::fromSRID(Vertical::EPSG_BLACK_SEA_HEIGHT); - $to = $from->verticalOffset($toCRS, new Metre(0.4)); + $to = $from->offset($toCRS, new Metre(0.4)); self::assertEqualsWithDelta(2.95, $to->getHeight()->getValue(), 0.001); } @@ -85,7 +85,7 @@ public function testVerticalOffsetAndSlope(): void $horizontalPoint = GeographicPoint::create(new Radian(0.826122513), new Radian(0.168715161), null, Geographic2D::fromSRID(Geographic2D::EPSG_ETRS89)); $from = VerticalPoint::create(new Metre(473), Vertical::fromSRID(Vertical::EPSG_LN02_HEIGHT)); $toCRS = Vertical::fromSRID(Vertical::EPSG_EVRF2000_HEIGHT); - $to = $from->verticalOffsetAndSlope($toCRS, new Radian(0.818850307), new Radian(0.142826110), new Metre(-0.245), new Radian(-0.000001018), new Radian(-0.000000155), 'urn:ogc:def:crs:EPSG::4258', $horizontalPoint); + $to = $from->offsetAndSlope($toCRS, new Radian(0.818850307), new Radian(0.142826110), new Metre(-0.245), new Radian(-0.000001018), new Radian(-0.000000155), 'urn:ogc:def:crs:EPSG::4258', $horizontalPoint); self::assertEqualsWithDelta(472.69, $to->getHeight()->asMetres()->getValue(), 0.001); } @@ -136,7 +136,7 @@ public function testVerticalOffsetGTXForward(): void $horizontalPoint = GeographicPoint::create(new Degree(-44.42), new Degree(168.92), null, Geographic2D::fromSRID(Geographic2D::EPSG_NZGD2000)); $from = VerticalPoint::create(new Metre(50), Vertical::fromSRID(Vertical::EPSG_NZVD2016_HEIGHT)); $toCRS = Vertical::fromSRID(Vertical::EPSG_DUNEDIN_1958_HEIGHT); - $to = $from->verticalOffsetGTX($toCRS, (new GTXDunedin1958NZVD2016Provider())->provideGrid(), '', false, $horizontalPoint); + $to = $from->offsetFromGrid($toCRS, (new GTXDunedin1958NZVD2016Provider())->provideGrid(), false, $horizontalPoint); self::assertEqualsWithDelta(50.304, $to->getHeight()->getValue(), 0.001); } @@ -149,7 +149,7 @@ public function testVerticalOffsetGTXReverse(): void $horizontalPoint = GeographicPoint::create(new Degree(-44.42), new Degree(168.92), null, Geographic2D::fromSRID(Geographic2D::EPSG_NZGD2000)); $from = VerticalPoint::create(new Metre(50.304), Vertical::fromSRID(Vertical::EPSG_DUNEDIN_1958_HEIGHT)); $toCRS = Vertical::fromSRID(Vertical::EPSG_NZVD2016_HEIGHT); - $to = $from->verticalOffsetGTX($toCRS, (new GTXDunedin1958NZVD2016Provider())->provideGrid(), '', true, $horizontalPoint); + $to = $from->offsetFromGrid($toCRS, (new GTXDunedin1958NZVD2016Provider())->provideGrid(), true, $horizontalPoint); self::assertEqualsWithDelta(50.000, $to->getHeight()->getValue(), 0.001); } @@ -162,7 +162,7 @@ public function testVerticalOffsetGTXUSVERTCON(): void $horizontalPoint = GeographicPoint::create(new Degree(29.4667897), new Degree(-98.4803739), null, Geographic2D::fromSRID(Geographic2D::EPSG_NAD83)); $from = VerticalPoint::create(new Metre(247.47), Vertical::fromSRID(Vertical::EPSG_NGVD29_HEIGHT_M)); $toCRS = Vertical::fromSRID(Vertical::EPSG_NAVD88_HEIGHT); - $to = $from->verticalOffsetGTX($toCRS, (new GTXNGVD29NAVD88CONUSCentralProvider())->provideGrid(), '', false, $horizontalPoint); + $to = $from->offsetFromGrid($toCRS, (new GTXNGVD29NAVD88CONUSCentralProvider())->provideGrid(), false, $horizontalPoint); self::assertEqualsWithDelta(247.599, $to->getHeight()->getValue(), 0.001); }