I need to include offline tiles (slippy map) into a Qt/Qml mobile application that mainly runs on Android and iOS.
The only well-documented and working solution I found
@Marco Piccolino, following our conversation from this other thread, here's the detailed workaround I've found so far, using only QtLocation, an offline tile cache, and a simple http server:
You need to place your png tiles into a folder tree like this: ".../tiles/1.0.0/sat/{z}/{x}/{y}.png", cf this link
You have to run an http server on that folder (you might want to use this command: sudo python -m SimpleHTTPServer 80)
You will have to edit your hosts file to map the following domain to your server's IP address (most probably 127.0.0.1): otile1.mqcdn.com. This trick is quite dirty but as this url is hardcoded inside the QtLocation OSM plugin we don't really have much of a choice with the current available QML API.
Finally the easiest part, in the QML code you should have something like this:
Plugin {
id: mapProvider
name: "osm"
}
Map {
anchors.fill: parent
plugin: mapProvider
gesture.enabled: true
activeMapType: supportedMapTypes[1]
}