aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEven Rouault <even.rouault@spatialys.com>2021-04-20 00:23:44 +0200
committerEven Rouault <even.rouault@spatialys.com>2021-04-20 00:32:49 +0200
commitf9d034afb73f3d5f08976ee9692f7a7c8eb09abf (patch)
tree5eab068c02e4ba45336c36885c86beda90dd19db
parentbd1d3d9a790266092dbbe3e440ebb00e2e25b700 (diff)
downloadPROJ-f9d034afb73f3d5f08976ee9692f7a7c8eb09abf.tar.gz
PROJ-f9d034afb73f3d5f08976ee9692f7a7c8eb09abf.zip
Revert "proj_create_crs_to_crs_from_pj(): do not use PROJ_SPATIAL_CRITERION_PARTIAL_INTERSECTION if area is specified"
This reverts commit ebe3425bf66287e004958eb53976d3837f88b9e1. It was found to break gdalwarp usage in https://github.com/OSGeo/gdal/issues/3695 when passing a bbox that is quite large.
-rw-r--r--src/4D_api.cpp6
-rw-r--r--test/unit/gie_self_tests.cpp24
2 files changed, 26 insertions, 4 deletions
diff --git a/src/4D_api.cpp b/src/4D_api.cpp
index 45f1f59e..8b676f9b 100644
--- a/src/4D_api.cpp
+++ b/src/4D_api.cpp
@@ -1358,11 +1358,9 @@ PJ *proj_create_crs_to_crs_from_pj (PJ_CONTEXT *ctx, const PJ *source_crs, cons
area->east_lon_degree,
area->north_lat_degree);
}
- else {
- proj_operation_factory_context_set_spatial_criterion(
- ctx, operation_ctx, PROJ_SPATIAL_CRITERION_PARTIAL_INTERSECTION);
- }
+ proj_operation_factory_context_set_spatial_criterion(
+ ctx, operation_ctx, PROJ_SPATIAL_CRITERION_PARTIAL_INTERSECTION);
proj_operation_factory_context_set_grid_availability_use(
ctx, operation_ctx,
proj_context_is_network_enabled(ctx) ?
diff --git a/test/unit/gie_self_tests.cpp b/test/unit/gie_self_tests.cpp
index 92f1c758..59b78497 100644
--- a/test/unit/gie_self_tests.cpp
+++ b/test/unit/gie_self_tests.cpp
@@ -804,6 +804,30 @@ TEST(gie, proj_create_crs_to_crs_outside_area_of_use) {
// ---------------------------------------------------------------------------
+TEST(gie, proj_create_crs_to_crs_with_area_large) {
+
+ // Test bugfix for https://github.com/OSGeo/gdal/issues/3695
+ auto area = proj_area_create();
+ proj_area_set_bbox(area, -14.1324, 49.5614, 3.76488, 62.1463);
+ auto P = proj_create_crs_to_crs(PJ_DEFAULT_CTX, "EPSG:4277", "EPSG:4326",
+ area);
+ proj_area_destroy(area);
+ ASSERT_TRUE(P != nullptr);
+ PJ_COORD c;
+
+ c.xyzt.x = 50; // Lat in deg
+ c.xyzt.y = -2; // Long in deg
+ c.xyzt.z = 0;
+ c.xyzt.t = HUGE_VAL;
+ c = proj_trans(P, PJ_FWD, c);
+ EXPECT_NEAR(c.xy.x, 50.00065628, 1e-8);
+ EXPECT_NEAR(c.xy.y, -2.00133989, 1e-8);
+
+ proj_destroy(P);
+}
+
+// ---------------------------------------------------------------------------
+
TEST(gie, proj_trans_generic) {
// GDA2020 to WGS84 (G1762)
auto P = proj_create(