Skip to content

Commit

Permalink
proj_create_operations(): allow CoordinateMetadata <--> CoordinateMet…
Browse files Browse the repository at this point in the history
…adata transformations
  • Loading branch information
rouault committed Aug 18, 2023
1 parent 74d98e2 commit 0db85a3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 14 deletions.
4 changes: 2 additions & 2 deletions docs/source/development/reference/functions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down
21 changes: 9 additions & 12 deletions src/iso19111/c_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<IdentifiedObjectNNPtr> 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),
Expand Down

0 comments on commit 0db85a3

Please sign in to comment.