Is there a way to figure out what OSM data is taking up the most space in my final mbtiles file?

For example, Connecticut is 54MB after I have made some modifications to the scripts in openmaptiles. This is larger than I want, and I want to know what is taking up so much space. Is there any such method of doing this?

  • Your question is all about mbtiles but your title includes postgis, please clarify and edit accordingly. – bugmenot123 Jul 2 at 8:12
  • Many of the open source tools create a postgresql database for the data, then creates the mbtiles from that. This is what I am referencing. – Nic Hubbard Jul 2 at 23:43

No, not without a lot of effort. The objects themselves are encoded as binary data for each map tile and their total contributing size to the file would include counting their representations on different zoom levels.

But you can find out which tiles are the biggest and investigate from there.

Since a MBTiles file is just a SQLite database, you can run SQL queries on it with any SQLite client.

To get the largest objects you can order by the size of the tile_data field:

SELECT *, length(tile_data)
FROM tiles
ORDER BY length(tile_data)

This will give you an ascending list of the 10 biggest tiles and their indexes.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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