diff options
| author | Even Rouault <even.rouault@spatialys.com> | 2019-09-23 14:27:50 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-09-23 14:27:50 +0200 |
| commit | a71fce63c2d77b6709005667efd577d728b900e9 (patch) | |
| tree | 4b3bcb89b8b94d9718f4cbf73db70f548ce798c0 /src | |
| parent | 91d3d51a5abafb773fca3e4aae3223cdedfc51af (diff) | |
| parent | da802e250b2487d41013829437740628b2ede667 (diff) | |
| download | PROJ-a71fce63c2d77b6709005667efd577d728b900e9.tar.gz PROJ-a71fce63c2d77b6709005667efd577d728b900e9.zip | |
Merge pull request #1631 from rouault/fix_1623
Document the autopromotion to 3D when mix of 2D/3D CRS in createOperations(), and test it (fixes #1623)
Diffstat (limited to 'src')
| -rw-r--r-- | src/apps/projinfo.cpp | 40 | ||||
| -rw-r--r-- | src/iso19111/c_api.cpp | 5 | ||||
| -rw-r--r-- | src/iso19111/coordinateoperation.cpp | 7 |
3 files changed, 11 insertions, 41 deletions
diff --git a/src/apps/projinfo.cpp b/src/apps/projinfo.cpp index 1760ae29..fd9b2f46 100644 --- a/src/apps/projinfo.cpp +++ b/src/apps/projinfo.cpp @@ -601,37 +601,6 @@ static void outputOperationSummary(const CoordinateOperationNNPtr &op, // --------------------------------------------------------------------------- -static size_t getAxisCount(const CRSNNPtr &crs) { - const auto singleCRS = dynamic_cast<const SingleCRS *>(crs.get()); - if (singleCRS) { - return singleCRS->coordinateSystem()->axisList().size(); - } - const auto compoundCRS = dynamic_cast<const CompoundCRS *>(crs.get()); - if (compoundCRS) { - size_t axisCount = 0; - const auto &components = compoundCRS->componentReferenceSystems(); - for (const auto &subCRS : components) { - axisCount += getAxisCount(subCRS); - } - return axisCount; - } - const auto boundCRS = dynamic_cast<const BoundCRS *>(crs.get()); - if (boundCRS) { - return getAxisCount(boundCRS->baseCRS()); - } - return 0; -} - -// --------------------------------------------------------------------------- - -static bool is2D(const CRSNNPtr &crs) { return getAxisCount(crs) == 2; } - -// --------------------------------------------------------------------------- - -static bool is3D(const CRSNNPtr &crs) { return getAxisCount(crs) == 3; } - -// --------------------------------------------------------------------------- - static void outputOperations( DatabaseContextPtr dbContext, const std::string &sourceCRSStr, const std::string &targetCRSStr, const ExtentPtr &bboxFilter, @@ -666,15 +635,6 @@ static void outputOperations( } auto nnTargetCRS = NN_NO_CHECK(targetCRS); - if (!promoteTo3D && !outputOpt.quiet && - ((is2D(nnSourceCRS) && is3D(nnTargetCRS)) || - (is3D(nnSourceCRS) && is2D(nnTargetCRS)))) { - std::cerr << "Warning: mix of 2D and 3D CRS. Vertical transformations, " - "if available, will not be applied. Consider using 3D " - "version of the CRS, or the --3d switch" - << std::endl; - } - std::vector<CoordinateOperationNNPtr> list; size_t spatialCriterionPartialIntersectionResultCount = 0; try { diff --git a/src/iso19111/c_api.cpp b/src/iso19111/c_api.cpp index fd4090b2..090d59a1 100644 --- a/src/iso19111/c_api.cpp +++ b/src/iso19111/c_api.cpp @@ -7080,6 +7080,11 @@ void PROJ_DLL proj_operation_factory_context_set_discard_superseded( * by increasing accuracy. Operations with unknown accuracy are sorted last, * whatever their area. * + * When one of the source or target CRS has a vertical component but not the + * other one, the one that has no vertical component is automatically promoted + * to a 3D version, where its vertical axis is the ellipsoidal height in metres, + * using the ellipsoid of the base geodetic CRS. + * * @param ctx PROJ context, or NULL for default context * @param source_crs source CRS. Must not be NULL. * @param target_crs source CRS. Must not be NULL. diff --git a/src/iso19111/coordinateoperation.cpp b/src/iso19111/coordinateoperation.cpp index aea8400c..56a3b38c 100644 --- a/src/iso19111/coordinateoperation.cpp +++ b/src/iso19111/coordinateoperation.cpp @@ -13445,8 +13445,13 @@ getResolvedCRS(const crs::CRSNNPtr &crs, * by increasing accuracy. Operations with unknown accuracy are sorted last, * whatever their area. * + * When one of the source or target CRS has a vertical component but not the + * other one, the one that has no vertical component is automatically promoted + * to a 3D version, where its vertical axis is the ellipsoidal height in metres, + * using the ellipsoid of the base geodetic CRS. + * * @param sourceCRS source CRS. - * @param targetCRS source CRS. + * @param targetCRS target CRS. * @param context Search context. * @return a list */ |
