diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 741a787..281f965 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -4,4 +4,5 @@ Current: - REMOVE: Removed setUTM() - NEW: warp() options: - useUTM - build output raster in UTM projection - - zerosAsND - set no data value to zero \ No newline at end of file + - zerosAsND - set no data value to zero + - FIX: calculation of UTM zone number diff --git a/src/msuproj-cli.cpp b/src/msuproj-cli.cpp index 751f151..88ff796 100644 --- a/src/msuproj-cli.cpp +++ b/src/msuproj-cli.cpp @@ -62,14 +62,11 @@ int main(int argc, char *argv[]) if (srcFile.empty() || gcpFile.empty()) { - printf("ERROR: input and output not specified\n" + printf("ERROR: input files are not specified\n" "print \"-h\" for help\n"); return 1; } - if (dstFile.empty()) - dstFile = srcFile + string(".tif"); - retCode code; code = msuObj.setSRC(srcFile.c_str()); @@ -86,6 +83,14 @@ int main(int argc, char *argv[]) return code; } + if (dstFile.empty()) + { + dstFile = srcFile; + if (useUTM) + dstFile += "_" + string(msuObj.getUTM()); + dstFile += ".tif"; + } + msuObj.setDST(dstFile.c_str()); printf("Processing warp operation"); diff --git a/src/msuproj.cpp b/src/msuproj.cpp index 30074ea..5e88781 100644 --- a/src/msuproj.cpp +++ b/src/msuproj.cpp @@ -112,8 +112,10 @@ const msumr::retCode msumr::msugeo::readGCP(const char *file) gcpXStep = srcXSize / gcpXSize + 1; gcpYStep = srcYSize / gcpYSize + 1; - zone = (int)((gcps[(int)(gcpSize / 2)].lon + 180) / 6) + 1; - hemisphere = (gcps[(int)(gcpSize / 2)].lat > 0); + zone = ((int)(((gcps[0].lon + gcps[gcpXSize - 1].lon + + gcps[gcpSize - gcpXSize].lon + gcps[gcpSize - 1].lon) / 4 + 180) / 6) + 1); + hemisphere = ((gcps[0].lat + gcps[gcpXSize - 1].lat + + gcps[gcpSize - gcpXSize].lat + gcps[gcpSize - 1].lat) / 4 > 0); return success; }