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

QML Map Debugging



  • I have made some small modifications to the minimal_map demo to allow it to use offline tiles. It works perfectly on my desktop, but when I run it on my embedded target, it only loads a blank gray screen. I assume that I am probably missing a required component on the embedded target. It has the QLocaiton module as well as the OSM plugin. The only error message that I get is qrc:/main.qml:87:24: Unable to assign [undefined] to QDeclarativeGeoMapType*. This is because on the embedded target, supportedMapTypes.length returns 0. Can someone recommend some ideas on how to debug this. It is difficult with only this error message.

    import QtQuick 2.0
    import QtQuick.Window 2.0
    import QtLocation 5.6
    import QtPositioning 5.6
    
    Window {
        width: 800
        height: 480
        visible: true
    
        Plugin {
            id: mapPlugin
            name: "osm"
    
            PluginParameter {
                name: "osm.mapping.custom.host"
                value: "file:///usr/bin/resources/maptiles/"
            }
            PluginParameter {
                name: "osm.mapping.providersrepository.disabled"
                value: true
            }
            PluginParameter {
                name: "osm.mapping.cache.directory"
                value: "/home/asdf/Documents/cache"
            }
    
            Component.onCompleted: {
                console.log("Plugin loaded")
            }
        }
    
        Map {
            anchors.fill: parent
            plugin: mapPlugin
            zoomLevel: 7
            activeMapType: supportedMapTypes[supportedMapTypes.length - 1]
    
            Component.onCompleted: {
                for( var i = 0; i < supportedMapTypes.length; i++) {
                    console.log(supportedMapTypes[i].name)
                }
    
                console.log("Map loaded")
            }
        }
    }
    

Log in to reply