From 0db85a37248f5518df4c302f44bc7b23ff42bb6c Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Fri, 18 Aug 2023 18:00:08 +0200 Subject: [PATCH] proj_create_operations(): allow CoordinateMetadata <--> CoordinateMetadata transformations --- .../development/reference/functions.rst | 4 ++-- src/iso19111/c_api.cpp | 21 ++++++++----------- 2 files changed, 11 insertions(+), 14 deletions(-) diff --git a/docs/source/development/reference/functions.rst b/docs/source/development/reference/functions.rst index 533a9942b0..035b2ade55 100644 --- a/docs/source/development/reference/functions.rst +++ b/docs/source/development/reference/functions.rst @@ -140,7 +140,7 @@ paragraph for more details. a CRS Starting with PROJ 9.2, source_crs or target_crs can be a CoordinateMetadata - with an associated coordinate epoch (but only one of them, not both). + with an associated coordinate epoch. An "area of use" can be specified in area. When it is supplied, the more accurate transformation between two given systems can be chosen. @@ -186,7 +186,7 @@ paragraph for more details. target CRS are passed as PJ* objects which must be of the CRS variety. Starting with PROJ 9.2, source_crs or target_crs can be a CoordinateMetadata - with an associated coordinate epoch (but only one of them, not both). + with an associated coordinate epoch. :param `options`: a list of NUL terminated options, or NULL. diff --git a/src/iso19111/c_api.cpp b/src/iso19111/c_api.cpp index babdc67fc1..bff2383160 100644 --- a/src/iso19111/c_api.cpp +++ b/src/iso19111/c_api.cpp @@ -8440,22 +8440,19 @@ proj_create_operations(PJ_CONTEXT *ctx, const PJ *source_crs, } } - if (sourceCoordinateMetadata != nullptr && - targetCoordinateMetadata != nullptr) { - proj_log_error(ctx, __FUNCTION__, - "CoordinateMetadata with epoch to CoordinateMetadata " - "with epoch not supported currently"); - return nullptr; - } - try { auto factory = CoordinateOperationFactory::create(); std::vector objects; auto ops = sourceCoordinateMetadata != nullptr - ? factory->createOperations( - NN_NO_CHECK(sourceCoordinateMetadata), - NN_NO_CHECK(targetCRS), - operationContext->operationContext) + ? (targetCoordinateMetadata != nullptr + ? factory->createOperations( + NN_NO_CHECK(sourceCoordinateMetadata), + NN_NO_CHECK(targetCoordinateMetadata), + operationContext->operationContext) + : factory->createOperations( + NN_NO_CHECK(sourceCoordinateMetadata), + NN_NO_CHECK(targetCRS), + operationContext->operationContext)) : targetCoordinateMetadata != nullptr ? factory->createOperations( NN_NO_CHECK(sourceCRS),