Search code examples
sqlitembtiles

joining together two mbtiles files


I haven't managed to find a way to join two *.mbtiles files together (first one contains zoom level from 0-16 and second one zoom level 17). I was working with different sqlite managers, but no mather how I have exported and imported database2 into database1, I had no success - binary field was always so badly corrupted that it couldn't get image.png back.

Does anyone know a simple procedurte of joining two mbtiles files together?


Solution

  • If the two files have the same metadata, and if the tiles tables are actually tables and not views, you can simply append the data of one to the other table:

    /* open database1 as main database, then: */
    ATTACH 'database2' AS db2;
    INSERT INTO tiles SELECT * FROM db2.tiles;