通过QtLocation插件使用离线数据 [英] Using offline data with QtLocation plugin

查看:0
本文介绍了通过QtLocation插件使用离线数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有500MB的脱机数据要与OSM QtLocation插件一起使用。我使用了这个博客https://www.qt.io/blog/2017/05/24/qtlocation-using-offline-map-tiles-openstreetmap-plugin中的示例源代码。示例应用程序中的数据嵌入在资源文件中,我希望将其放在磁盘上的单独文件夹中。首先,我想让示例应用程序与位于磁盘上的文件夹中的示例数据一起工作,而不是在资源文件中编译。在执行应用程序时,它仍然从在线服务器下载数据。我在网上读了很多文章,但没有一个解决方案奏效。我使用的是带有MSVC编译器的Qt 5.15.2,Windows 10。

这是我的代码的外观。

import QtQuick 2.7
import QtQuick.Window 2.2
import QtLocation 5.8

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 {
            id: osmPLugin
            name: 'osm';
            PluginParameter { name: 'osm.mapping.offline.directory'; value: 'file:///c:/offline_tiles/' }
        }
    }
}

推荐答案

您必须使用路径,而不是URI:

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

这篇关于通过QtLocation插件使用离线数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆