qt - 通过 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/' }
推荐阅读
- javascript - Jquery 自动完成在结果和结果之间有空格,而结果没有以模式显示
- ruby-on-rails - 为什么在生产中运行我的 rails 应用程序时会出现此错误,但在开发中却没有?
- elixir - 如何在 elixir 中查询空或 nil 关联
- r - 如何根据类将向量与数据框匹配
- logging - 将 X-Fowarded-For 添加到 FTP 日志
- python - 如何将列表中的元素拆分并生成到数据场
- objective-c - NSDate 用 floorf 删除小数会产生奇怪的输出
- python - 如何解决 ResourceExhaustedError?为什么会有这么大的张量?
- python - 为什么 django hashers 使用断言?
- pyspark - 手动创建 pyspark 数据框