在 QML 中使用离线交互式地图 [英] Use an offline interactive map in QML

查看:40
本文介绍了在 QML 中使用离线交互式地图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想注入一块我从 OpenStreetMaposm 文件的形式.

I'd like to inject a chunk of map that I got from OpenStreetMap under the form of an osm file.

根据我在文档中阅读的内容,Open Street Map插件 似乎没有任何参数将源文件作为地图.它仅适用于服务器.问题是我在运行我的应用程序时没有 Internet 连接.我需要在内部使用地图.

From what I've read in the documentation, the Open Street Map Plugin doesn't seem to have any parameter taking a source file as a map. It only works with a server. Problem is I won't have an Internet connection when running my application. I need to use a map internally.

MapboxHERE 插件.

还有其他方法吗?

这是创建地图的样板:

Plugin {
    id: somePlugin
    // code here to choose the plugin as necessary
}

Map {
    id: map

    plugin: somePlugin

    center {
        latitude: -27
        longitude: 153
    }
    zoomLevel: map.minimumZoomLevel

    gesture.enabled: true
}

推荐答案

2017 年 4 月更新: QtLocation 现在支持离线 OSM 磁贴.请参阅 http://doc.qt.io/qt-5/location-plugin-osm.html

Update April 2017: QtLocation now supports offline OSM tiles. See http://doc.qt.io/qt-5/location-plugin-osm.html

正如您所注意到的,QtLocation 目前没有为您提供离线选项. 此外,对于底图,它目前仅支持 图像图块(不您所说的 XML 矢量 OSM 数据).

As you note, QtLocation currently does not give you the offline option. Also, for basemaps it currently only supports image tiles (not the XML vector OSM data you are talking about).

你有几个选择:

在 QML 中:您可以使用 ArcGIS Runtime SDK for Qt.从版本 10.26 开始,它支持添加带有离线切片的自定义地图图层.您需要先获取 OSM 数据的 PNG/JPG 图块.这是一个支持 OSM slippymap 瓦片的示例层.

In QML: you can use the ArcGIS Runtime SDK for Qt. Starting from version 10.26 it supports adding custom map layers with offline tiles. You will need to get PNG/JPG tiles of your OSM data first. Here is an example layer that supports OSM slippymap tiles.

在 C++ 中:您会发现一些显示矢量数据的选项,这些数据可能需要或不需要从 OSM 格式转换,还有更多工作要做:

In C++: you will find a few options to display vector data that might require or not conversion from the OSM format and more work on your side:

另外,不要忘记在 Qt Bugtracker 中为上述问题投票!

Also, don't forget to vote for the issues mentioned above in Qt Bugtracker!

这篇关于在 QML 中使用离线交互式地图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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