GDAL create mbtiles with differing image by zoom levelFinding good Mbtiles to png tiles converter?combining mbtiles and getZoom to visualize with LeafletWhere is street level data stored in mbtiles files?Remove black borders when converting GeoTiff to MBTile with gdal_translateConvert .tif to .mbtiles using python/GDALCombining vector and raster tiles in mbtiles file?MBTiles with 512x512 pixel tiles?MbTiles is not shown at a specific scale in QGIS 3.2Knowing correct amount of overview levels for raster?QGIS 3.4 - create mbtiles from QGIS server

How does one intimidate enemies without having the capacity for violence?

A newer friend of my brother's gave him a load of baseball cards that are supposedly extremely valuable. Is this a scam?

declaring a variable twice in IIFE

A Journey Through Space and Time

How to type dʒ symbol (IPA) on Mac?

How can I fix this gap between bookcases I made?

What is the meaning of "of trouble" in the following sentence?

Download, install and reboot computer at night if needed

A function which translates a sentence to title-case

The use of multiple foreign keys on same column in SQL Server

What typically incentivizes a professor to change jobs to a lower ranking university?

Accidentally leaked the solution to an assignment, what to do now? (I'm the prof)

Do airline pilots ever risk not hearing communication directed to them specifically, from traffic controllers?

What Brexit solution does the DUP want?

Extreme, but not acceptable situation and I can't start the work tomorrow morning

Chess with symmetric move-square

What do you call a Matrix-like slowdown and camera movement effect?

Can an x86 CPU running in real mode be considered to be basically an 8086 CPU?

Patience, young "Padovan"

Is there a minimum number of transactions in a block?

Why is "Reports" in sentence down without "The"

How did the USSR manage to innovate in an environment characterized by government censorship and high bureaucracy?

Japan - Plan around max visa duration

Motorized valve interfering with button?



GDAL create mbtiles with differing image by zoom level


Finding good Mbtiles to png tiles converter?combining mbtiles and getZoom to visualize with LeafletWhere is street level data stored in mbtiles files?Remove black borders when converting GeoTiff to MBTile with gdal_translateConvert .tif to .mbtiles using python/GDALCombining vector and raster tiles in mbtiles file?MBTiles with 512x512 pixel tiles?MbTiles is not shown at a specific scale in QGIS 3.2Knowing correct amount of overview levels for raster?QGIS 3.4 - create mbtiles from QGIS server






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















I want to build an mbtiles with different map detail at different zoom levels (e.g. contours at 1m at levels >16 and 5m <=16). I've exported raster images at the right resolution using QGIS and now want to combine them with GDAL.



gdal_translate -of mbtiles -co "TILE_FORMAT=PNG8" Level19.png basemap_hires.mbtiles
gdaladdo -r nearest basemap_hires.mbtiles 2 4
gdal_translate -of mbtiles -co "TILE_FORMAT=PNG8" Level16.png basemap_lores.mbtiles
gdaladdo -r nearest basemap_lores.mbtiles 2 4 8 16


generates levels 19->17 from the hi-res map and levels 16->12 from the lo-res map, in separate files. But I'd like to combine them into one file.



Any ideas? Of course, I could use just the Level19.png file and do 2 4 8 16 32 64 with gdaladdo, but then the level 16->12 tiles will have too much detail (and puny labels). In a way, this is a replacement for QTiles3 on the cheap, since it would generate the "right" map at all scale levels, but it's not robust for me in QGIS and I really only need 2 levels of detail.










share|improve this question




























    0















    I want to build an mbtiles with different map detail at different zoom levels (e.g. contours at 1m at levels >16 and 5m <=16). I've exported raster images at the right resolution using QGIS and now want to combine them with GDAL.



    gdal_translate -of mbtiles -co "TILE_FORMAT=PNG8" Level19.png basemap_hires.mbtiles
    gdaladdo -r nearest basemap_hires.mbtiles 2 4
    gdal_translate -of mbtiles -co "TILE_FORMAT=PNG8" Level16.png basemap_lores.mbtiles
    gdaladdo -r nearest basemap_lores.mbtiles 2 4 8 16


    generates levels 19->17 from the hi-res map and levels 16->12 from the lo-res map, in separate files. But I'd like to combine them into one file.



    Any ideas? Of course, I could use just the Level19.png file and do 2 4 8 16 32 64 with gdaladdo, but then the level 16->12 tiles will have too much detail (and puny labels). In a way, this is a replacement for QTiles3 on the cheap, since it would generate the "right" map at all scale levels, but it's not robust for me in QGIS and I really only need 2 levels of detail.










    share|improve this question
























      0












      0








      0








      I want to build an mbtiles with different map detail at different zoom levels (e.g. contours at 1m at levels >16 and 5m <=16). I've exported raster images at the right resolution using QGIS and now want to combine them with GDAL.



      gdal_translate -of mbtiles -co "TILE_FORMAT=PNG8" Level19.png basemap_hires.mbtiles
      gdaladdo -r nearest basemap_hires.mbtiles 2 4
      gdal_translate -of mbtiles -co "TILE_FORMAT=PNG8" Level16.png basemap_lores.mbtiles
      gdaladdo -r nearest basemap_lores.mbtiles 2 4 8 16


      generates levels 19->17 from the hi-res map and levels 16->12 from the lo-res map, in separate files. But I'd like to combine them into one file.



      Any ideas? Of course, I could use just the Level19.png file and do 2 4 8 16 32 64 with gdaladdo, but then the level 16->12 tiles will have too much detail (and puny labels). In a way, this is a replacement for QTiles3 on the cheap, since it would generate the "right" map at all scale levels, but it's not robust for me in QGIS and I really only need 2 levels of detail.










      share|improve this question














      I want to build an mbtiles with different map detail at different zoom levels (e.g. contours at 1m at levels >16 and 5m <=16). I've exported raster images at the right resolution using QGIS and now want to combine them with GDAL.



      gdal_translate -of mbtiles -co "TILE_FORMAT=PNG8" Level19.png basemap_hires.mbtiles
      gdaladdo -r nearest basemap_hires.mbtiles 2 4
      gdal_translate -of mbtiles -co "TILE_FORMAT=PNG8" Level16.png basemap_lores.mbtiles
      gdaladdo -r nearest basemap_lores.mbtiles 2 4 8 16


      generates levels 19->17 from the hi-res map and levels 16->12 from the lo-res map, in separate files. But I'd like to combine them into one file.



      Any ideas? Of course, I could use just the Level19.png file and do 2 4 8 16 32 64 with gdaladdo, but then the level 16->12 tiles will have too much detail (and puny labels). In a way, this is a replacement for QTiles3 on the cheap, since it would generate the "right" map at all scale levels, but it's not robust for me in QGIS and I really only need 2 levels of detail.







      gdal mbtiles gdaladdo






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Apr 3 at 18:25









      HouskaHouska

      6807




      6807




















          2 Answers
          2






          active

          oldest

          votes


















          1














          This is basis SQL to combine the various mbtiles. You can do it from command line with Sqlite3 or in your favorite sqlite editor I like Sqlite Expert Professional open first database and then attach second and do insert into tiles. The other way I do this is extract mbtiles to folder of tiles for each database and then run python mbutil or other scripts or tiles2gpkg_parallel.py to build a geopackage






          share|improve this answer























          • This set me down the right path. For the benefit of others who don't breathe SQL, I'll put the code as a separate answer.

            – Houska
            Apr 4 at 11:18



















          0














          Expanding on GeospatialInformationTech's answer, here's what worked for me:



          gdal_translate -of mbtiles -co "TILE_FORMAT=PNG8" -co "ZLEVEL=9" "Level 19.tif" "mapbase.mbtiles"
          gdaladdo -r nearest -oo "TILE_FORMAT=PNG8" -oo "ZLEVEL=9" "mapbase.mbtiles" 2 4
          gdal_translate -of mbtiles -co "TILE_FORMAT=PNG8" -co "ZLEVEL=9" "Level 16.tif" "mapbase low.mbtiles"
          gdaladdo -r nearest -oo "TILE_FORMAT=PNG8" -oo "ZLEVEL=9" "mapbase low.mbtiles" 2 4 8 16
          echo ATTACH "mapbase low.mbtiles" AS low; INSERT INTO main.tiles SELECT * FROM low.tiles; | sqlite3 "mapbase.mbtiles"


          The -co and -oo compress the map, otherwise the mbtiles grows huge (this is for rendered patterned maps, jpeg would probably be better if there were aerial photos involved). The powers of 2 in the gdaladdo lines buildup exactly the right overlays to avoid overlap, in this case levels (19 18 17)(16 15 14 13 12). The last line, written Windows batch format here, uses sqlite3 (already installed with QGIS/osg4w) to munge it together.



          I was expecting to have to also do a echo UPDATE metadata SET value=12 WHERE name='minzoom' | sqlite3 "mapbase.mbtiles" to fix the minimum zoom level after the SQL merge, but it was somehow automagically correct.



          Someone asked why I don't use vector tiles (though that comment is now gone). 1) Better control of rendering with QGIS, 2) My users use the mbtiles output as offline maps in Guru/Galileo maps on iOS, and there's no mention in its docs that vector tiles in mbtiles would be supported (it's possible they are, since they have their own offline vector maps).






          share|improve this answer























            Your Answer








            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "79"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: false,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: null,
            bindNavPrevention: true,
            postfix: "",
            imageUploader:
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            ,
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













            draft saved

            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgis.stackexchange.com%2fquestions%2f317690%2fgdal-create-mbtiles-with-differing-image-by-zoom-level%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            1














            This is basis SQL to combine the various mbtiles. You can do it from command line with Sqlite3 or in your favorite sqlite editor I like Sqlite Expert Professional open first database and then attach second and do insert into tiles. The other way I do this is extract mbtiles to folder of tiles for each database and then run python mbutil or other scripts or tiles2gpkg_parallel.py to build a geopackage






            share|improve this answer























            • This set me down the right path. For the benefit of others who don't breathe SQL, I'll put the code as a separate answer.

              – Houska
              Apr 4 at 11:18
















            1














            This is basis SQL to combine the various mbtiles. You can do it from command line with Sqlite3 or in your favorite sqlite editor I like Sqlite Expert Professional open first database and then attach second and do insert into tiles. The other way I do this is extract mbtiles to folder of tiles for each database and then run python mbutil or other scripts or tiles2gpkg_parallel.py to build a geopackage






            share|improve this answer























            • This set me down the right path. For the benefit of others who don't breathe SQL, I'll put the code as a separate answer.

              – Houska
              Apr 4 at 11:18














            1












            1








            1







            This is basis SQL to combine the various mbtiles. You can do it from command line with Sqlite3 or in your favorite sqlite editor I like Sqlite Expert Professional open first database and then attach second and do insert into tiles. The other way I do this is extract mbtiles to folder of tiles for each database and then run python mbutil or other scripts or tiles2gpkg_parallel.py to build a geopackage






            share|improve this answer













            This is basis SQL to combine the various mbtiles. You can do it from command line with Sqlite3 or in your favorite sqlite editor I like Sqlite Expert Professional open first database and then attach second and do insert into tiles. The other way I do this is extract mbtiles to folder of tiles for each database and then run python mbutil or other scripts or tiles2gpkg_parallel.py to build a geopackage







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Apr 3 at 23:34









            GeospatialInformationTechGeospatialInformationTech

            64737




            64737












            • This set me down the right path. For the benefit of others who don't breathe SQL, I'll put the code as a separate answer.

              – Houska
              Apr 4 at 11:18


















            • This set me down the right path. For the benefit of others who don't breathe SQL, I'll put the code as a separate answer.

              – Houska
              Apr 4 at 11:18

















            This set me down the right path. For the benefit of others who don't breathe SQL, I'll put the code as a separate answer.

            – Houska
            Apr 4 at 11:18






            This set me down the right path. For the benefit of others who don't breathe SQL, I'll put the code as a separate answer.

            – Houska
            Apr 4 at 11:18














            0














            Expanding on GeospatialInformationTech's answer, here's what worked for me:



            gdal_translate -of mbtiles -co "TILE_FORMAT=PNG8" -co "ZLEVEL=9" "Level 19.tif" "mapbase.mbtiles"
            gdaladdo -r nearest -oo "TILE_FORMAT=PNG8" -oo "ZLEVEL=9" "mapbase.mbtiles" 2 4
            gdal_translate -of mbtiles -co "TILE_FORMAT=PNG8" -co "ZLEVEL=9" "Level 16.tif" "mapbase low.mbtiles"
            gdaladdo -r nearest -oo "TILE_FORMAT=PNG8" -oo "ZLEVEL=9" "mapbase low.mbtiles" 2 4 8 16
            echo ATTACH "mapbase low.mbtiles" AS low; INSERT INTO main.tiles SELECT * FROM low.tiles; | sqlite3 "mapbase.mbtiles"


            The -co and -oo compress the map, otherwise the mbtiles grows huge (this is for rendered patterned maps, jpeg would probably be better if there were aerial photos involved). The powers of 2 in the gdaladdo lines buildup exactly the right overlays to avoid overlap, in this case levels (19 18 17)(16 15 14 13 12). The last line, written Windows batch format here, uses sqlite3 (already installed with QGIS/osg4w) to munge it together.



            I was expecting to have to also do a echo UPDATE metadata SET value=12 WHERE name='minzoom' | sqlite3 "mapbase.mbtiles" to fix the minimum zoom level after the SQL merge, but it was somehow automagically correct.



            Someone asked why I don't use vector tiles (though that comment is now gone). 1) Better control of rendering with QGIS, 2) My users use the mbtiles output as offline maps in Guru/Galileo maps on iOS, and there's no mention in its docs that vector tiles in mbtiles would be supported (it's possible they are, since they have their own offline vector maps).






            share|improve this answer



























              0














              Expanding on GeospatialInformationTech's answer, here's what worked for me:



              gdal_translate -of mbtiles -co "TILE_FORMAT=PNG8" -co "ZLEVEL=9" "Level 19.tif" "mapbase.mbtiles"
              gdaladdo -r nearest -oo "TILE_FORMAT=PNG8" -oo "ZLEVEL=9" "mapbase.mbtiles" 2 4
              gdal_translate -of mbtiles -co "TILE_FORMAT=PNG8" -co "ZLEVEL=9" "Level 16.tif" "mapbase low.mbtiles"
              gdaladdo -r nearest -oo "TILE_FORMAT=PNG8" -oo "ZLEVEL=9" "mapbase low.mbtiles" 2 4 8 16
              echo ATTACH "mapbase low.mbtiles" AS low; INSERT INTO main.tiles SELECT * FROM low.tiles; | sqlite3 "mapbase.mbtiles"


              The -co and -oo compress the map, otherwise the mbtiles grows huge (this is for rendered patterned maps, jpeg would probably be better if there were aerial photos involved). The powers of 2 in the gdaladdo lines buildup exactly the right overlays to avoid overlap, in this case levels (19 18 17)(16 15 14 13 12). The last line, written Windows batch format here, uses sqlite3 (already installed with QGIS/osg4w) to munge it together.



              I was expecting to have to also do a echo UPDATE metadata SET value=12 WHERE name='minzoom' | sqlite3 "mapbase.mbtiles" to fix the minimum zoom level after the SQL merge, but it was somehow automagically correct.



              Someone asked why I don't use vector tiles (though that comment is now gone). 1) Better control of rendering with QGIS, 2) My users use the mbtiles output as offline maps in Guru/Galileo maps on iOS, and there's no mention in its docs that vector tiles in mbtiles would be supported (it's possible they are, since they have their own offline vector maps).






              share|improve this answer

























                0












                0








                0







                Expanding on GeospatialInformationTech's answer, here's what worked for me:



                gdal_translate -of mbtiles -co "TILE_FORMAT=PNG8" -co "ZLEVEL=9" "Level 19.tif" "mapbase.mbtiles"
                gdaladdo -r nearest -oo "TILE_FORMAT=PNG8" -oo "ZLEVEL=9" "mapbase.mbtiles" 2 4
                gdal_translate -of mbtiles -co "TILE_FORMAT=PNG8" -co "ZLEVEL=9" "Level 16.tif" "mapbase low.mbtiles"
                gdaladdo -r nearest -oo "TILE_FORMAT=PNG8" -oo "ZLEVEL=9" "mapbase low.mbtiles" 2 4 8 16
                echo ATTACH "mapbase low.mbtiles" AS low; INSERT INTO main.tiles SELECT * FROM low.tiles; | sqlite3 "mapbase.mbtiles"


                The -co and -oo compress the map, otherwise the mbtiles grows huge (this is for rendered patterned maps, jpeg would probably be better if there were aerial photos involved). The powers of 2 in the gdaladdo lines buildup exactly the right overlays to avoid overlap, in this case levels (19 18 17)(16 15 14 13 12). The last line, written Windows batch format here, uses sqlite3 (already installed with QGIS/osg4w) to munge it together.



                I was expecting to have to also do a echo UPDATE metadata SET value=12 WHERE name='minzoom' | sqlite3 "mapbase.mbtiles" to fix the minimum zoom level after the SQL merge, but it was somehow automagically correct.



                Someone asked why I don't use vector tiles (though that comment is now gone). 1) Better control of rendering with QGIS, 2) My users use the mbtiles output as offline maps in Guru/Galileo maps on iOS, and there's no mention in its docs that vector tiles in mbtiles would be supported (it's possible they are, since they have their own offline vector maps).






                share|improve this answer













                Expanding on GeospatialInformationTech's answer, here's what worked for me:



                gdal_translate -of mbtiles -co "TILE_FORMAT=PNG8" -co "ZLEVEL=9" "Level 19.tif" "mapbase.mbtiles"
                gdaladdo -r nearest -oo "TILE_FORMAT=PNG8" -oo "ZLEVEL=9" "mapbase.mbtiles" 2 4
                gdal_translate -of mbtiles -co "TILE_FORMAT=PNG8" -co "ZLEVEL=9" "Level 16.tif" "mapbase low.mbtiles"
                gdaladdo -r nearest -oo "TILE_FORMAT=PNG8" -oo "ZLEVEL=9" "mapbase low.mbtiles" 2 4 8 16
                echo ATTACH "mapbase low.mbtiles" AS low; INSERT INTO main.tiles SELECT * FROM low.tiles; | sqlite3 "mapbase.mbtiles"


                The -co and -oo compress the map, otherwise the mbtiles grows huge (this is for rendered patterned maps, jpeg would probably be better if there were aerial photos involved). The powers of 2 in the gdaladdo lines buildup exactly the right overlays to avoid overlap, in this case levels (19 18 17)(16 15 14 13 12). The last line, written Windows batch format here, uses sqlite3 (already installed with QGIS/osg4w) to munge it together.



                I was expecting to have to also do a echo UPDATE metadata SET value=12 WHERE name='minzoom' | sqlite3 "mapbase.mbtiles" to fix the minimum zoom level after the SQL merge, but it was somehow automagically correct.



                Someone asked why I don't use vector tiles (though that comment is now gone). 1) Better control of rendering with QGIS, 2) My users use the mbtiles output as offline maps in Guru/Galileo maps on iOS, and there's no mention in its docs that vector tiles in mbtiles would be supported (it's possible they are, since they have their own offline vector maps).







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Apr 4 at 11:33









                HouskaHouska

                6807




                6807



























                    draft saved

                    draft discarded
















































                    Thanks for contributing an answer to Geographic Information Systems Stack Exchange!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid


                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.

                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgis.stackexchange.com%2fquestions%2f317690%2fgdal-create-mbtiles-with-differing-image-by-zoom-level%23new-answer', 'question_page');

                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    រឿង រ៉ូមេអូ និង ហ្ស៊ុយលីយេ សង្ខេបរឿង តួអង្គ បញ្ជីណែនាំ

                    QGIS export composer to PDF scale the map [closed] Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) Announcing the arrival of Valued Associate #679: Cesar Manara Unicorn Meta Zoo #1: Why another podcast?Print Composer QGIS 2.6, how to export image?QGIS 2.8.1 print composer won't export all OpenCycleMap base layer tilesSave Print/Map QGIS composer view as PNG/PDF using Python (without changing anything in visible layout)?Export QGIS Print Composer PDF with searchable text labelsQGIS Print Composer does not change from landscape to portrait orientation?How can I avoid map size and scale changes in print composer?Fuzzy PDF export in QGIS running on macSierra OSExport the legend into its 100% size using Print ComposerScale-dependent rendering in QGIS PDF output

                    PDF-ში გადმოწერა სანავიგაციო მენიუproject page