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

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

问题描述

我想注入从打开街道地图插件似乎没有任何参数将源文件作为映射.它仅适用于服务器.问题是运行应用程序时我没有Internet连接.我需要在内部使用地图.

Mapbox 解决方案

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

您注意到,QtLocation当前不提供离线选项.此外,对于底图,它目前仅支持图像图块(不您正在讨论的XML矢量OSM数据.)

您有几种选择:

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

在C ++中:您会找到一些选项来显示可能需要从OSM格式转换或不需要从OSM格式转换的矢量数据,并且需要您做更多的工作:

此外,别忘了为Qt Bugtracker中提到的问题投票!

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

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.

Ditto for Mapbox and HERE plugins.

Is there any other way to do this?

Here is the boilerplate to create a Map:

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
}

解决方案

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

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).

You have a few alternatives:

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.

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:

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

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

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