From 9a2fc14ac03a6fcb707907e91279b47b4b439482 Mon Sep 17 00:00:00 2001 From: Doug Wright Date: Sat, 24 Apr 2021 22:00:38 +0100 Subject: [PATCH] Adjust test points to be within accurate extents --- tests/CoordinateOperation/AutoConversionTest.php | 16 ++++++++-------- tests/GeographicPoint2DTest.php | 7 +++---- tests/GeographicPointTest.php | 6 +++--- 3 files changed, 14 insertions(+), 15 deletions(-) diff --git a/tests/CoordinateOperation/AutoConversionTest.php b/tests/CoordinateOperation/AutoConversionTest.php index b4841f804..d5212f6a6 100644 --- a/tests/CoordinateOperation/AutoConversionTest.php +++ b/tests/CoordinateOperation/AutoConversionTest.php @@ -184,22 +184,22 @@ public function testPZ9011ToITRF2008NoEpoch(): void public function testBritishNationalGridToOSGB(): void { - $from = ProjectedPoint::createFromEastingNorthing(new Metre(577274.99), new Metre(69740.50), Projected::fromSRID(Projected::EPSG_OSGB36_BRITISH_NATIONAL_GRID)); + $from = ProjectedPoint::createFromEastingNorthing(new Metre(573502.85), new Metre(180912.71), Projected::fromSRID(Projected::EPSG_OSGB36_BRITISH_NATIONAL_GRID)); $toCRS = Geographic2D::fromSRID(Geographic2D::EPSG_OSGB36); $to = $from->convert($toCRS); - self::assertEqualsWithDelta(50.5, $to->getLatitude()->getValue(), 0.0001); + self::assertEqualsWithDelta(51.5, $to->getLatitude()->getValue(), 0.0001); self::assertEqualsWithDelta(0.5, $to->getLongitude()->getValue(), 0.0001); } public function testBritishNationalGridToUTM(): void { - $from = ProjectedPoint::createFromEastingNorthing(new Metre(577274.99), new Metre(69740.50), Projected::fromSRID(Projected::EPSG_OSGB36_BRITISH_NATIONAL_GRID)); + $from = ProjectedPoint::createFromEastingNorthing(new Metre(573502.85), new Metre(180912.71), Projected::fromSRID(Projected::EPSG_OSGB36_BRITISH_NATIONAL_GRID)); $toCRS = Projected::fromSRID(Projected::EPSG_WGS_84_UTM_GRID_SYSTEM_NORTHERN_HEMISPHERE); $to = $from->convert($toCRS); - self::assertEqualsWithDelta(31322594.503502, $to->getEasting()->getValue(), 0.0001); - self::assertEqualsWithDelta(5597286.6916335, $to->getNorthing()->getValue(), 0.0001); + self::assertEqualsWithDelta(31326366.159092, $to->getEasting()->getValue(), 0.0001); + self::assertEqualsWithDelta(5708455.7715515, $to->getNorthing()->getValue(), 0.0001); } public function testETRSLN02ToETRSEVRF2000(): void @@ -211,12 +211,12 @@ public function testETRSLN02ToETRSEVRF2000(): void BoundingArea::createWorld(), ); - $from = CompoundPoint::create(GeographicPoint::create(new Radian(0.826122513), new Radian(0.168715161), null, Geographic2D::fromSRID(Geographic2D::EPSG_ETRS89)), VerticalPoint::create(new Metre(473), Vertical::fromSRID(Vertical::EPSG_LN02_HEIGHT)), $fromCRS); + $from = CompoundPoint::create(GeographicPoint::create(new Radian(0.826122513), new Radian(0.167215161), null, Geographic2D::fromSRID(Geographic2D::EPSG_ETRS89)), VerticalPoint::create(new Metre(473), Vertical::fromSRID(Vertical::EPSG_LN02_HEIGHT)), $fromCRS); $toCRS = Compound::fromSRID(Compound::EPSG_ETRS89_PLUS_EVRF2000_HEIGHT); $to = $from->convert($toCRS); self::assertEqualsWithDelta(0.826122513, $to->getHorizontalPoint()->getLatitude()->asRadians()->getValue(), 0.0000000001); - self::assertEqualsWithDelta(0.168715161, $to->getHorizontalPoint()->getLongitude()->asRadians()->getValue(), 0.0000000001); - self::assertEqualsWithDelta(472.69, $to->getVerticalPoint()->getHeight()->asMetres()->getValue(), 0.001); + self::assertEqualsWithDelta(0.167215161, $to->getHorizontalPoint()->getLongitude()->asRadians()->getValue(), 0.0000000001); + self::assertEqualsWithDelta(472.691, $to->getVerticalPoint()->getHeight()->asMetres()->getValue(), 0.001); } } diff --git a/tests/GeographicPoint2DTest.php b/tests/GeographicPoint2DTest.php index f5e1f2b20..a0dfabfc8 100644 --- a/tests/GeographicPoint2DTest.php +++ b/tests/GeographicPoint2DTest.php @@ -55,14 +55,13 @@ public function testOperations(string $sourceCrsSrid, string $targetCrsSrid, str self::assertEquals($targetCRS, $newPoint->getCRS()); if ($reversible) { - $delta = isset($operation['method']) && $operation['method'] === CoordinateOperationMethods::EPSG_REVERSIBLE_POLYNOMIAL_OF_DEGREE_13 ? 0.01 : 0.001; $reversedPoint = $newPoint->performOperation($operationSrid, $sourceCRS, true); self::assertEquals($sourceCRS, $reversedPoint->getCRS()); - self::assertEqualsWithDelta($originalPoint->getLatitude()->getValue(), $reversedPoint->getLatitude()->getValue(), $delta); - self::assertEqualsWithDelta($originalPoint->getLongitude()->getValue(), $reversedPoint->getLongitude()->getValue(), $delta); + self::assertEqualsWithDelta($originalPoint->getLatitude()->getValue(), $reversedPoint->getLatitude()->getValue(), 0.002); + self::assertEqualsWithDelta($originalPoint->getLongitude()->getValue(), $reversedPoint->getLongitude()->getValue(), 0.002); if ($sourceHeight) { - self::assertEqualsWithDelta($originalPoint->getHeight()->getValue(), $reversedPoint->getHeight()->getValue(), $delta); + self::assertEqualsWithDelta($originalPoint->getHeight()->getValue(), $reversedPoint->getHeight()->getValue(), 0.002); } else { self::assertNull($reversedPoint->getHeight()); } diff --git a/tests/GeographicPointTest.php b/tests/GeographicPointTest.php index 5bb390369..62b93ed2f 100644 --- a/tests/GeographicPointTest.php +++ b/tests/GeographicPointTest.php @@ -761,12 +761,12 @@ public function testObliqueMercatorHotineVariantB(): void public function testTransverseMercator(): void { - $from = GeographicPoint::create(new Degree(50.5), new Degree(0.5), null, Geographic2D::fromSRID(Geographic2D::EPSG_OSGB36)); + $from = GeographicPoint::create(new Degree(51.5), new Degree(0.5), null, Geographic2D::fromSRID(Geographic2D::EPSG_OSGB36)); $toCRS = Projected::fromSRID(Projected::EPSG_OSGB36_BRITISH_NATIONAL_GRID); $to = $from->transverseMercator($toCRS, new Degree(49), new Degree(-2), new Unity(0.9996012717), new Metre(400000), new Metre(-100000)); - self::assertEqualsWithDelta(577274.99, $to->getEasting()->asMetres()->getValue(), 0.01); - self::assertEqualsWithDelta(69740.50, $to->getNorthing()->asMetres()->getValue(), 0.01); + self::assertEqualsWithDelta(573502.85, $to->getEasting()->asMetres()->getValue(), 0.01); + self::assertEqualsWithDelta(180912.71, $to->getNorthing()->asMetres()->getValue(), 0.01); } public function testTransverseMercatorSouthOrientated(): void