OSM Plugin : Offline map view



  • I have been trying to get off line map viewing in Qt 5.9.1. I have been using OsmOffline mentioned in QtLocation: using offline map tiles with the OpenStreetMap plugin.
    Kindly help me find the right steps to follow.


  • Moderators

    @name_qt
    not a single question in your post.
    It would be very helpful to at least describe properly where you are stuck...

    Beside that, the link you referred to also contains a complete example project. Have you tried it?!



  • Hi @raven-worx,
    Of course i tried the example project and i am not able to view the maps off line.
    I am using the following osm plugin parameter.

    osm.mapping.offline.directory
    

    This is the code i am using for displaying the map

    import QtQuick 2.7
    import QtQuick.Window 2.2
    import QtLocation 5.9
    
    Window {
        id: win
        objectName: "window"
        visible: true
        width: 512
        height: 512
    
        Map {
            id: map
            anchors.fill: parent
            activeMapType: map.supportedMapTypes[1]
            zoomLevel: 1
            plugin: Plugin {
                name: 'osm';
                PluginParameter {
                    name: 'osm.mapping.offline.directory'
                    value: ':/offline_tiles/'
                }
            }
        }
    }
    

    Can you please point out any mistakes i might be committing in the qml file ?


  • Moderators

    @name_qt said in OSM Plugin : Offline map view:

    :/offline_tiles/

    and all the offline tiles are in the qrc?!
    Show your qrc file pls.



  • @raven-worx

    <RCC>
        <qresource prefix="/">
            <file>main.qml</file>
    
            <file>offline_tiles/osm_100-l-3-0-0-0.png</file>
            <file>offline_tiles/osm_100-l-3-1-0-0.png</file>
            <file>offline_tiles/osm_100-l-3-1-0-1.png</file>
            <file>offline_tiles/osm_100-l-3-1-1-0.png</file>
            <file>offline_tiles/osm_100-l-3-1-1-1.png</file>
            <file>offline_tiles/osm_100-l-3-2-0-0.png</file>
            <file>offline_tiles/osm_100-l-3-2-0-1.png</file>
            <file>offline_tiles/osm_100-l-3-2-0-2.png</file>
            <file>offline_tiles/osm_100-l-3-2-0-3.png</file>
            <file>offline_tiles/osm_100-l-3-2-1-0.png</file>
            <file>offline_tiles/osm_100-l-3-2-1-1.png</file>
            <file>offline_tiles/osm_100-l-3-2-1-2.png</file>
            <file>offline_tiles/osm_100-l-3-2-1-3.png</file>
            <file>offline_tiles/osm_100-l-3-2-2-0.png</file>
            <file>offline_tiles/osm_100-l-3-2-2-1.png</file>
            <file>offline_tiles/osm_100-l-3-2-2-2.png</file>
            <file>offline_tiles/osm_100-l-3-2-2-3.png</file>
            <file>offline_tiles/osm_100-l-3-2-3-0.png</file>
            <file>offline_tiles/osm_100-l-3-2-3-1.png</file>
            <file>offline_tiles/osm_100-l-3-2-3-2.png</file>
            <file>offline_tiles/osm_100-l-3-2-3-3.png</file>
        </qresource>
    </RCC>
    


  • I am running this project in Ubuntu 16.04. If that makes any change.



  • When i gave

    activeMapType: map.supportedMapTypes[2]
    

    the map started working of-line. It was a mismatch of the maptype.


Log in to reply
 

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