【发布时间】:2021-08-08 07:52:23
【问题描述】:
我正在尝试使用我的机器托管的自定义服务器绘制离线地图。我已经按照这个project for docker 的步骤。当我使用我的浏览器(http://localhost:8080/)时它可以工作。但是当我尝试使用下面的代码访问 QML 时,我只得到一个静态图像 GPS 输出
.
我做错了什么?正如我在浏览器中看到的那样,我应该以良好的分辨率看到赞比亚。
QML 代码
import QtQuick 2.12
import QtQuick.Controls 2.5
import QtQuick.VirtualKeyboard 2.4
import QtLocation 5.11
ApplicationWindow {
id: window
width: 640
height: 480
visible: true
title: qsTr("GPS")
Plugin{
id: plugin_osm
name: "osm"
PluginParameter {
name: "osm.mapping.custom.host"
value: "http://localhost:8080"
}
/*disable retrieval of the providers information from the remote repository.
If this parameter is not set to true (as shown here), then while offline,
network errors will be generated at run time*/
PluginParameter {
name: "osm.mapping.providersrepository.disabled"
value: true
}
}
Map {
id: map
anchors.fill: parent
plugin: plugin_osm
zoomLevel: 12
minimumZoomLevel: 5
maximumZoomLevel: 17
center: QtPositioning.coordinate(54.2,16.2)
activeMapType: supportedMapTypes[supportedMapTypes.length - 1]
}
}
【问题讨论】:
-
你能告诉我你是怎么放地图的吗?表示包含地图的文件夹。你应该使用平铺地图。 (TMS)
-
@Parisa.H.R 没有文件夹。该地图位于 docker 卷内。码头工人运行一个服务器,并把我请求的瓷砖带给我。
-
docker如何获取地图?从哪里?有一次我使用 apache2 来做这样的事情。重要的是您的地图是 TMS。
-
所以,有一个与docker绑定的文件夹。当前位置在路径中:/home/zambia-latest.osm.pbf
-
不,应该是名称只有数字(1,2,3,..)的文件夹,这个数字显示地图的缩放级别,每个文件夹中都有 png 或 jpg 平铺地图。喜欢this question folder picture
标签: qt qml openstreetmap offline qtlocation