I'm developing a PC application that uses local OSM tiles. I'm using OSM docker from switch2osm to generate XYZ .png tiles for a given area and supply directory with tiles to our clients with our app. I'm using Python/Kivy/MapView for displaying tiles.

My problem is with the number of tiles - for example map of Poland in zoom levels 9-16 takes up over 20GB disk space and over 4 million files. Reducing disk space usage would be nice, but most importantly I want to reduce numer of tiles that need to be compressed, extracted, copied etc. I know that standard 256x256 tiles are great for serving over web, but I'm thinking to moving to 512x512 (or even 1024x1024) tiles for local tiles in hope of reducing number of files while still maintaining the details shown on the map.

I have few ideas that I'd like to get some feedback from more experienced OSM developers:

  1. simply stitch 4 256x256 .png files together into one 512x512 file (for example 4 tiles of zoom=16 become one tile of zoom=15)
  2. change mapnik/renderd configuration to render 512x512 tiles with higher level of details (on zoom=15 tiles show everything that's visible by default on zoom=16)
  3. switch to raster .mbtiles

I would prefer going with 2. since it's more general solution than 1. and needs less changes in app code than 3., but I'm in the dark as what exactly needs to be changed in tile server configuration. If anybody have any tips / resources I'd appreciate it.

  • It's not obvious to me that merging tiles will save you much space
    – Ian Turton
    Oct 10, 2023 at 22:30
  • as i wrote, disk space is secondary. copying milllions of files between computers (even very small files) takes ages (i have been zipping them <without compression> together to speed this up, but zipping and extracting also takes a lot time). merging tiles would reduce number of files, which i belive would speed this up
    – user208190
    Oct 11, 2023 at 10:40
  • so would using a more efficient program like tar or rsync work better
    – Ian Turton
    Oct 11, 2023 at 13:20

1 Answer 1


Don't use tiles on disk. The number of files you have once you're dealing with a large area becomes unmanageable, as you've seen.

Instead, combine your tiles into one file. This could be mbtiles or PMTiles. You're more likely to find support for mbtiles because it's old.

You could see some gains from larger tiles, but you would still want to use a container format. Geofabrik did some experiments on larger tiles because they had to use tiles on disk and cluster size was an issue.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.