| 126 | } |
| 127 | |
| 128 | void runGdalWriter2(const Options& wo, const std::string& outfile, |
| 129 | const std::string& values, bool stream) |
| 130 | { |
| 131 | FileUtils::deleteFile(outfile); |
| 132 | |
| 133 | Options ro; |
| 134 | ro.add("filename", Support::datapath("gdal/grid.txt")); |
| 135 | |
| 136 | Options ro2; |
| 137 | ro2.add("filename", Support::datapath("gdal/grid2.txt")); |
| 138 | |
| 139 | TextReader r; |
| 140 | r.setOptions(ro); |
| 141 | |
| 142 | TextReader r2; |
| 143 | r2.setOptions(ro2); |
| 144 | |
| 145 | GDALWriter w; |
| 146 | w.setOptions(wo); |
| 147 | w.setInput(r); |
| 148 | w.setInput(r2); |
| 149 | |
| 150 | if (!stream) |
| 151 | { |
| 152 | PointTable t; |
| 153 | |
| 154 | w.prepare(t); |
| 155 | w.execute(t); |
| 156 | } |
| 157 | else |
| 158 | { |
| 159 | FixedPointTable t(10); |
| 160 | |
| 161 | w.prepare(t); |
| 162 | w.execute(t); |
| 163 | } |
| 164 | |
| 165 | using namespace gdal; |
| 166 | |
| 167 | Utils::IStringStreamClassicLocale iss(values); |
| 168 | |
| 169 | std::vector<double> arr; |
| 170 | while (true) |
| 171 | { |
| 172 | double d; |
| 173 | iss >> d; |
| 174 | if (!iss) |
| 175 | break; |
| 176 | arr.push_back(d); |
| 177 | } |
| 178 | |
| 179 | gdal::Raster raster(outfile, "GTiff"); |
| 180 | if (raster.open() != gdal::GDALError::None) |
| 181 | { |
| 182 | throw pdal_error(raster.errorMsg()); |
| 183 | } |
| 184 | std::vector<double> data; |
| 185 | raster.readBand(data, 1); |
no test coverage detected