Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-64287

Can't use mapboxgl cache

    XMLWordPrintable

Details

    • Bug
    • Resolution: Duplicate
    • P1: Critical
    • None
    • 5.9.2
    • None
    • qt 5.9.2, on linux

    Description

      Hi,

       

      About the "mapboxgl.mapping.cache.directory" plugin parameter, it says in the documentation that

      This cache can also be used for storing offline tiles, but the offline database must be populated using the offline tool

       

      I've been trying to do this for a couple of days with no success. 

      Firstly, it appears that the name of the database must be "mapboxgl.db", since any other file in the said directory appears to be ignored. Please correct me if I'm wrong, or please update the documentation.

      Secondly, the database schema is important. for example using the latest offline tool (compiled from latest mapbox-gl-native) and qt-5.9.0 doesn't work (I see that this is not easily solved since qt would have to be forward compatible).

      Finally, even after I solved the two issues above, the map simply refuses to use the tiles that were inserted by the offline tool. This is what I tried:

      1. I disconnect from the internet and run my app
      2. The map is black, and I get the following error:
        1. [ERROR][Setup]: loading style failed: Host api.mapbox.com not found

      Then I connect myself to the internet, and start my app then the map is correctly shown. In this case the map pulls all the needed tiles and inserts them in the database. Now I can look into the database, into the "tiles" table, and see that there some tiles are duplicated. One version was inserted by the offline tool, the other is the ambient cache. Some things I find really strange:

      1. There is a  UNIQUE (url_template, pixel_ratio, z, x, y) constraint in that table, however it is being violated:
        1. mapbox://tiles/mapbox.mapbox-terrain-v2,mapbox.mapbox-streets-v7/{z}/{x}/{y}.vector.pbf|1|15|15548|12572
        2. mapbox://tiles/mapbox.mapbox-terrain-v2,mapbox.mapbox-streets-v7/{z}/{x}/{y}.vector.pbf|1|15|15548|12572
      2. The contents of all the remaining fields of the duplicated records are exactly the same (except for expires and accessed fields).
      3. The expires field is 12 hours after what is in the accessed field. Does this mean that the persistent cache only lasts 12 hours?

       Then I stop the app, disconnect the internet, and start the app again. Then the map shows correctly for a while (as it is using the ambient cache obtained while connected), but then starts to fail with

      [ERROR] [Style]: Failed to load tile 15/15545/12571=>15 for source composite: Host api.mapbox.com not found

      which I guess happens when these tiles are not in the ambient cache (they are in database however).

      So you see, I'm probably assuming a lot of incorrect stuff. Any clues?

      Thanks for reading, and keep up the good work.

      Marco

       

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              tmpsantos Thiago Marcos P. Santos
              marcovc marcovc
              Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes