From 062c7f160f4b1d41f82730fa6eb6653e78ade74a Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Thu, 9 Jul 2020 15:45:28 +0200 Subject: Transverse Mercator South Orientated: restrict export to PROJ string to cases where false_easting and false_northing are 0 --- src/iso19111/coordinateoperation.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'src') diff --git a/src/iso19111/coordinateoperation.cpp b/src/iso19111/coordinateoperation.cpp index dd8658fb..3d5287a3 100644 --- a/src/iso19111/coordinateoperation.cpp +++ b/src/iso19111/coordinateoperation.cpp @@ -6165,6 +6165,25 @@ void Conversion::_exportToPROJString( std::string("Unsupported value for ") + EPSG_NAME_PARAMETER_LATITUDE_OF_NATURAL_ORIGIN); } + } else if (methodEPSGCode == + EPSG_CODE_METHOD_TRANSVERSE_MERCATOR_SOUTH_ORIENTATED) { + // We map TMSO to tmerc with axis=wsu. This only works if false easting + // and northings are zero, which is the case in practice for South + // African and Namibian EPSG CRS + const auto falseEasting = parameterValueNumeric( + EPSG_CODE_PARAMETER_FALSE_EASTING, common::UnitOfMeasure::METRE); + if (falseEasting != 0) { + throw io::FormattingException( + std::string("Unsupported value for ") + + EPSG_NAME_PARAMETER_FALSE_EASTING); + } + const auto falseNorthing = parameterValueNumeric( + EPSG_CODE_PARAMETER_FALSE_NORTHING, common::UnitOfMeasure::METRE); + if (falseNorthing != 0) { + throw io::FormattingException( + std::string("Unsupported value for ") + + EPSG_NAME_PARAMETER_FALSE_NORTHING); + } // PROJ.4 specific hack for webmercator } else if (formatter->getCRSExport() && methodEPSGCode == -- cgit v1.2.3