aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEven Rouault <even.rouault@spatialys.com>2020-10-20 14:43:57 +0200
committerEven Rouault <even.rouault@spatialys.com>2020-10-20 14:43:57 +0200
commitd18c1972dfe480847353c03a5c4aa259e7d1b482 (patch)
tree716015174334f2e5b21308655b98953817044bb3 /src
parenta8ca9b4b9f560dc6c1b49234844432d27d4b8000 (diff)
downloadPROJ-d18c1972dfe480847353c03a5c4aa259e7d1b482.tar.gz
PROJ-d18c1972dfe480847353c03a5c4aa259e7d1b482.zip
Orthographic projection: do not add f=0 to PROJ string if the ellipsoid is a sphere (fixes GDAL PDS4 tests)
Diffstat (limited to 'src')
-rw-r--r--src/iso19111/coordinateoperation.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/iso19111/coordinateoperation.cpp b/src/iso19111/coordinateoperation.cpp
index 184ff435..3577b6ff 100644
--- a/src/iso19111/coordinateoperation.cpp
+++ b/src/iso19111/coordinateoperation.cpp
@@ -6332,6 +6332,27 @@ void Conversion::_exportToPROJString(
}
bAxisSpecFound = true;
}
+
+ // No need to add explicit f=0 if the ellipsoid is a sphere
+ if (strcmp(mapping->proj_name_aux, "f=0") == 0) {
+ crs::CRS *horiz = l_sourceCRS.get();
+ const auto compound =
+ dynamic_cast<const crs::CompoundCRS *>(horiz);
+ if (compound) {
+ const auto &components =
+ compound->componentReferenceSystems();
+ if (!components.empty()) {
+ horiz = components.front().get();
+ }
+ }
+
+ auto geogCRS =
+ dynamic_cast<const crs::GeographicCRS *>(horiz);
+ if (geogCRS && geogCRS->ellipsoid()->isSphere()) {
+ addAux = false;
+ }
+ }
+
if (addAux) {
auto kv = split(mapping->proj_name_aux, '=');
if (kv.size() == 2) {