OSM Offline map in user accessible directory



  • Hello

    I am trying to implement offline maps in my application. I tried the example below and it works perfectly.
    http://blog.qt.io/blog/2017/05/24/qtlocation-using-offline-map-tiles-openstreetmap-plugin/

    However i would like to store the map tiles in a user accessible folder. Ideally a relative Path in the same directory as the executable.
    I tried to modify the Plugin Parameter to a absolute path on windows for testing :
    value: 'c:/offline_tiles/' but that does not seem to work .Could i please get some advice on how to do that ?

    Thank you in advance

        plugin: Plugin {
            name: 'osm';
            PluginParameter {
                name: 'osm.mapping.offline.directory'
                value: 'c:/offline_tiles/'
            }
        }

  • Lifetime Qt Champion

    Hi,

    You should also add which version of Qt you are using as well as the Windows version and compiler.



  • @SGaist Sorry , using QT5.9.1 pn windows 10 with mingw
    but planning to run it on raspberry pi later.

    I just found the issue now , Map types had to be changed from 1 to 2
    activeMapType: map.supportedMapTypes[2] and changed the value to the relative path of my Executables directory
    value: 'file:///offline_tiles/'
    my code looks now like this and it works now when i switch my internet connection off :

    import QtQuick 2.8
    import QtLocation 5.8
    import QtPositioning 5.8

    Item {
    id: mapItem
    anchors.fill: parent
    Rectangle{
    anchors.fill: parent
    Map {
    id: map
    anchors.fill: parent
    activeMapType: map.supportedMapTypes[2]
    zoomLevel: 1
    plugin: Plugin {
    name: 'osm';
    PluginParameter {
    name: 'osm.mapping.offline.directory'
    value: 'file:///offline_tiles/'
    }
    }
    }
    }
    }


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.