diff --git a/src/decoders/TileDecoder.cc b/src/decoders/TileDecoder.cc index 1244c10a..9a455367 100644 --- a/src/decoders/TileDecoder.cc +++ b/src/decoders/TileDecoder.cc @@ -294,7 +294,6 @@ PointsHandler& TileDecoder::points(const Transformation& t, bool) { map first, last; if ( mode_ == "opencharts") { - // netcdf.get(projection_ + "_lat", latitudes, first, last); // netcdf.get(projection_ + "_lon", longitudes, first, last); netcdf.get(projection_ + "_index", values, first, last); @@ -477,8 +476,10 @@ Data* TileDecoder::next() { void TileDecoder::decode() { - if (matrix_.size()) - return; + if (matrix_.size()) { + matrix_ = Matrix(); + + } string path = weights(); @@ -513,39 +514,41 @@ void TileDecoder::decode() { int nblat = netcdf.getDimension("lat") - 1; int nblon = netcdf.getDimension("lon") - 1; - if (bbox.empty()) { - netcdf.get("bounding-box", bbox, first, last); + + netcdf.get("bounding-box", bbox, first, last); - int error; - FILE* in = fopen(file_name_.c_str(), "rb"); - if (!in) { - if (MagicsGlobal::strict()) { - throw CannotOpenFile(file_name_); - } - MagLog::error() << "ERROR: unable to create handle from file" << file_name_ << endl; - return; + int error; + FILE* in = fopen(file_name_.c_str(), "rb"); + if (!in) { + if (MagicsGlobal::strict()) { + throw CannotOpenFile(file_name_); } - - // Adding a gutter of 5 points to avoid borders in tiles - int miny = std::min(bbox[1], bbox[3]); - miny = std::max(0, miny - 5); - int maxy = std::max(bbox[1], bbox[3]); - maxy = std::min(nblat, maxy + 5); - int minx = std::min(bbox[0], bbox[2]); - minx = std::max(0, minx - 5); - int maxx = std::max(bbox[0], bbox[2]); - maxx = std::min(nblon, maxx + 5); - - first["lat"] = tostring(miny); - first["lon"] = tostring(minx); - last["lat"] = tostring(maxy); - last["lon"] = tostring(maxx); - - netcdf.get("lat", latitudes, first, last); - netcdf.get("lon", longitudes, first, last); - netcdf.get("index", dindex, first, last); - netcdf.get("distances", distances, first, last); + MagLog::error() << "ERROR: unable to create handle from file" << file_name_ << endl; + return; } + + // Adding a gutter of 5 points to avoid borders in tiles + int miny = std::min(bbox[1], bbox[3]); + miny = std::max(0, miny - 5); + int maxy = std::max(bbox[1], bbox[3]); + maxy = std::min(nblat, maxy + 5); + int minx = std::min(bbox[0], bbox[2]); + minx = std::max(0, minx - 5); + int maxx = std::max(bbox[0], bbox[2]); + maxx = std::min(nblon, maxx + 5); + + first["lat"] = tostring(miny); + first["lon"] = tostring(minx); + last["lat"] = tostring(maxy); + last["lon"] = tostring(maxx); + + + + netcdf.get("lat", latitudes, first, last); + netcdf.get("lon", longitudes, first, last); + netcdf.get("index", dindex, first, last); + netcdf.get("distances", distances, first, last); + } int index[4];