Inconsistent Subtile Counts When Splitting Tiles to Higher Zoom Levels

I’m experiencing an issue when splitting a tile into subtiles for a higher zoom level (for example, from zoom 13 to zoom 15). My current extracting process is:

  1. I start with the original OSM file (osm.pbf) corresponding to a tile at zoom level 13.
  2. I use a Tile class to represent the original tile, and then split this tile into subtiles for a higher target zoom level. Each subtile is an instance of the Tile class that contains information such as its bounding box, its x and y coordinates, and its top-left and bottom-right geographical coordinates.
  3. I iterate over all the generated subtiles.
  4. For each subtile, I run the osmium-extract command. This command uses the calculated bounding box to extract a new osm.pbf file specifically for that subtile.

Instead of consistently producing the expected 16 subtiles in a uniform 4x4 grid, the process sometimes yields only 12 subtiles and, in other cases, up to 20 subtiles. This discrepancy appears to cause problems during extraction—specifically, some subtiles that spill over (e.g., 4 out of 20) may end up extracting data from the wrong parent tile, resulting in data loss from the correct parent tile.

I’ve attempted to refine my tile-splitting logic and even experimented with an iterative split (from zoom 13 to 14 to 15), but it still doesn’t reliably produce a uniform 4-tile split.

Has anyone encountered this issue, or could suggest ways to mitigate it?

Where do you get your “original OSM file” from? Can you share one of these files?

1 Like