aboutsummaryrefslogtreecommitdiff
path: root/src/iso19111
diff options
context:
space:
mode:
authorEven Rouault <even.rouault@spatialys.com>2020-11-16 13:57:09 +0100
committerEven Rouault <even.rouault@spatialys.com>2020-11-16 14:34:33 +0100
commit63f9f4e09ab26f1a52751cec15f394e88660b8bf (patch)
treedf6541743ae031304b3ea7419db0b2a33d9b1bf6 /src/iso19111
parent1a98229ed2c738bd563122084a08d36b2bf0ebaf (diff)
downloadPROJ-63f9f4e09ab26f1a52751cec15f394e88660b8bf.tar.gz
PROJ-63f9f4e09ab26f1a52751cec15f394e88660b8bf.zip
WKT2 parsing: several fixes related to map projection parameter units
- WKT2 grammar: accept PARAMETER[name,value,id] without unit - Recognize "Ellipsoid scaling factor" as a parameter with a scaling unit, and defaults to Unity when not specified - WKT2 parsing: implement the requirement of 18-010r7.html#80, that is when a map projection parameter has no explicit unit, use metre/degree/unity as the default unit (contrary to WKT1 parsing rules where they are deduced from the GeogCRS angular unit and coordinate system)
Diffstat (limited to 'src/iso19111')
-rw-r--r--src/iso19111/io.cpp15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/iso19111/io.cpp b/src/iso19111/io.cpp
index b2e5822b..623ad6f9 100644
--- a/src/iso19111/io.cpp
+++ b/src/iso19111/io.cpp
@@ -2944,7 +2944,8 @@ UnitOfMeasure WKTParser::Private::guessUnitForParameter(
const UnitOfMeasure &defaultAngularUnit) {
UnitOfMeasure unit;
// scale must be first because of 'Scale factor on pseudo standard parallel'
- if (ci_find(paramName, "scale") != std::string::npos) {
+ if (ci_find(paramName, "scale") != std::string::npos ||
+ ci_find(paramName, "scaling factor") != std::string::npos) {
unit = UnitOfMeasure::SCALE_UNITY;
} else if (ci_find(paramName, "latitude") != std::string::npos ||
ci_find(paramName, "longitude") != std::string::npos ||
@@ -3876,8 +3877,16 @@ WKTParser::Private::buildProjectedCRS(const WKTNodeNNPtr &node) {
return createPseudoMercator(props, NN_NO_CHECK(cartesianCS));
}
- auto linearUnit = buildUnitInSubNode(node, UnitOfMeasure::Type::LINEAR);
- auto angularUnit = baseGeodCRS->coordinateSystem()->axisList()[0]->unit();
+ // For WKT2, if there is no explicit parameter unit, use metre for linear
+ // units and degree for angular units
+ auto linearUnit =
+ !isNull(conversionNode)
+ ? UnitOfMeasure::METRE
+ : buildUnitInSubNode(node, UnitOfMeasure::Type::LINEAR);
+ auto angularUnit =
+ !isNull(conversionNode)
+ ? UnitOfMeasure::DEGREE
+ : baseGeodCRS->coordinateSystem()->axisList()[0]->unit();
auto conversion =
!isNull(conversionNode)