首页 > 解决方案 > 如何从 Qt QML Map 访问 WMS 或 WMTS

问题描述

我想知道是否可以从 QML 地图访问Web Map ServiceWeb Map Tile Service 。据我所知,没有可用的地理服务插件,所以我猜它需要开发。

WMTS 可能类似于:http://mt0.google.com/vt/lyrs=s&hl=en&x={x}&y={y}&z={z}https://c.tile.openstreetmap.org/{z}/{x}/{y}.png.

我的 QML 地图的代码很简单:

ApplicationWindow {
    id: root
    width: 512
    height: 512
    title: qsTr("Title")
    visible: true

    Plugin {
        id: mapPlugin
        name: 'osm' // esri
    }

    Map {
        id: map
        plugin: mapPlugin
        center: QtPositioning.coordinate(60.170448, 24.942046) // Helsinki
        zoomLevel: 14

        anchors.fill: parent
    }
}

我没有找到任何可用的解决方案来解决这个问题。那么,如何编写一个基于 (x,y,z) 三元组执行 WMTS 请求的地理服务插件?

标签: qtqmlqtlocation

解决方案


您将不得不编写自己的插件。我将根据这个 repo https://github.com/dirkvdb/qt-location-plugin-wmts/tree/develop/plugin做同样的事情


推荐阅读