Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

How to get OSM plugin to exclusively use offline tiles and not fetch anything from the Server ?



  • I have been playing around with the OSM plugin . I have some custom tiles in my offline directory.
    I would like the OSM plugin to only use my offline tiles without fetching anything from the server .
    So if you are in a place without any offline tiles available the screen should stay black.
    So far my code works in that it uses my offline tiles , but still fetches missing tiles from the server.
    Is it possible to disable the server altogether or do I have to create a custom server ?

    import QtQuick 2.8
    import QtLocation 5.8
    import QtPositioning 5.8
    
    Item {
    id: mapItem
    anchors.fill: parent
    Rectangle{
        anchors.fill: parent
        Plugin {
            id: mapPlugin
            name: "osm"
            //Offline directory for Map Tiles
            PluginParameter {
                name: 'osm.mapping.offline.directory'
                value: ':/GPSTracks/'
            }
            //Disable to Fetch Map Data from the Server
            PluginParameter {
               name: "osm.mapping.providersrepository.disabled"
               value: true
            }
        }
    
        Map {
            id: map
            anchors.fill: parent
            plugin: mapPlugin
            center: 
           QtPositioning.coordinate(-26.074278,28.752637)
            zoomLevel: 16
            activeMapType: map.supportedMapTypes[1]
            copyrightsVisible : false
            gesture.enabled: true
            tilt: 0
            color: "black"
    
        }
      }
    }


  • Try it offline, this way it wont go online and fetch tiles.. just a thought. lets see if you get any errors.


Log in to reply