Skip to content
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
1 change: 1 addition & 0 deletions changes/5999.fix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Allows for slightly unsquare pixels from projected GDAL products and fixes axes parsing for longitude direction.
27 changes: 16 additions & 11 deletions isis/src/core/src/Pvl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -190,16 +190,21 @@ namespace Isis {
projJson = projJson["base_crs"];
}

std::string direction = projJson["coordinate_system"]["axis"][1]["direction"];
if (direction == "east") {
mappingGroup.addKeyword(PvlKeyword("LongitudeDirection", "PositiveEast"));
}
else if (direction == "west") {
mappingGroup.addKeyword(PvlKeyword("LongitudeDirection", "PositiveWest"));
}
else {
QString msg = "Unknown direction [" + QString::fromStdString(direction) + "]";
throw IException(IException::Programmer, msg, _FILEINFO_);
nlohmann::json axes = projJson["coordinate_system"]["axis"];
for (nlohmann::json axis : axes) {
if (axis["name"] == "Longitude") {
std::string direction = axis["direction"];
if (direction == "east") {
mappingGroup.addKeyword(PvlKeyword("LongitudeDirection", "PositiveEast"));
}
else if (direction == "west") {
mappingGroup.addKeyword(PvlKeyword("LongitudeDirection", "PositiveWest"));
}
else {
QString msg = "Unknown direction [" + QString::fromStdString(direction) + "]";
throw IException(IException::Programmer, msg, _FILEINFO_);
}
}
}

if (oSRS.GetSemiMajor() == oSRS.GetSemiMinor()) {
Expand All @@ -215,7 +220,7 @@ namespace Isis {
// Read the GeoTransform and get the elements we care about
double *padfTransform = new double[6];
dataset->GetGeoTransform(padfTransform);
if (abs(padfTransform[1]) != abs(padfTransform[5])) {
if ((abs(padfTransform[1]) - abs(padfTransform[5])) > 1e-2) {
delete[] padfTransform;
QString msg = "Vertical and horizontal resolution do not match";
throw IException(IException::Io, msg, _FILEINFO_);
Expand Down
Loading