forked from rspatial/terra
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
33 lines (28 loc) · 889 Bytes
/
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#include <iostream>
#include "spatRaster.h"
#include "file_utils.h"
#include "show.h"
#include "fun.h"
int main(int argc, char *argv[]) {
std::vector<std::string> arguments = std::vector<std::string>(argv, argv + argc);
arguments[0] = arguments[0].substr(arguments[0].find_last_of("/\\") + 1);
if (arguments.size() < 2) {
std::string msg = "usage: " + arguments[0] + " method input output parameters";
std::cout << msg << std::endl;
return 1;
}
GDALAllRegister();
SpatRaster out;
std::string method = arguments[1];
//SpatRaster input(arguments[2], {-1}, {""});
//show(input);
if (method == "show") out = SpatRaster(arguments[2], {-1}, {""}, {""}, {""});
if (method == "aggregate") out = aggregate(arguments);
if (out.hasError()) {
std::cout << out.msg.error << std::endl;
return 1;
} else {
show(out);
}
return 0;
}