I am using QML on Qt to display OpenStreetMap (using the osm plugin), which requires internet connection. Is there a way that I can do the same but running it offline? For example, running my own tile server (but how easy is that to do)? Or using a library that will let me do it quite quickly.
By the way I am running my program on Ubuntu.
Any help on how to do that and especially if someone can provide the steps to be done would be appreciated.
Thank you.
I have managed to display OpenStreetMap offline in Qt (using QML) following the steps below:
On my map.qml file in Qt, I had to include the following parameters on the map plugin (http://doc.qt.io/qt-5/location-plugin-osm.html):
Plugin {
id: osmMapPlugin
name: "osm"
//provide the address of the tile server to the plugin
PluginParameter {
name: "osm.mapping.custom.host"
value: "http://localhost/osm/"
}
/*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
}
}
Finally, the activeMapType
property of the Map QML type has to be set to MapType.CustomMap
(http://doc.qt.io/qt-5/qml-qtlocation-maptype.html) for the map to work with the local tile server.
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