Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WKT2 parsing: several fixes related to map projection parameter units #2427

Merged
merged 1 commit into from
Nov 16, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions src/iso19111/io.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 ||
Expand Down Expand Up @@ -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)
Expand Down
Loading