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!
You can generate or download tiles for offline usage. For generating tiles take a look at TileMill or Maperitive. Downloading tiles can be achieved via Marble and various other tools, but please respect the tile server's usage policy! Downloading high zoom tiles causes high load on the tile server because these tiles are usually not cached and need to be rendered on the fly.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With