Skip to content

Commit

Permalink
Fix filenames south of the equator.
Browse files Browse the repository at this point in the history
For custom file formats, the latitudes -9 to 0 had the wrong
number of digits in the filename, causing the tiles to be missed.
  • Loading branch information
akirmse committed Nov 18, 2024
1 parent 960c289 commit fc24243
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions code/flt_loader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -194,13 +194,16 @@ string FltLoader::getFltFilename(double minLat, double minLng, const FileFormat
fractionalDegree(minLng));
break;

case FileFormat::Value::CUSTOM:
snprintf(buf, sizeof(buf), "tile_%02dx%02d_%03dx%02d.flt",
static_cast<int>(upperLat),
case FileFormat::Value::CUSTOM: {
int upperLatInt = static_cast<int>(upperLat); // Watch out for "minus 0"
snprintf(buf, sizeof(buf), "tile_%s%02dx%02d_%03dx%02d.flt",
(upperLatInt >= 0) ? "" : "-",
abs(upperLatInt),
fractionalDegree(upperLat),
static_cast<int>(minLng),
fractionalDegree(minLng));
break;
}

case FileFormat::Value::THREEDEP_1M:
// Note order: X (lng), then Y (lat)
Expand Down

0 comments on commit fc24243

Please sign in to comment.