Qt offline maps using osm tiles
-
I am developing an application for which i need offline maps as my device won't be having internet connection. i tried example given in this link
http://blog.qt.io/blog/2017/05/24/qtlocation-using-offline-map-tiles-openstreetmap-plugin/
but this needs tiles to be renamed according to the criteria given in the post. if i have so many tiles how to rename those? it seems very difficult.Another example i have seen is using lightmaps on the following link
but this example seems to not using any plugin and difficult to understand. in this example only the last zoom level is displayed and zoom is not working.
has anybody used offline maps in Qt please guide me. I have generated files using Maperitive tool from zoom level 16 to 18
-
Hello hem1
Read this articles https://wiki.openstreetmap.org/wiki/QuadTiles and https://wiki.openstreetmap.org/wiki/Slippy_map_tilenames this is what you want, to work with offline tiles. .
Regards,
Jasur -
@Jasur i read these all i can see them explaining about tile naming convention but i want to know is there any software by which automatically i should get tiles named according to slippy maps naming convention? as i downloaded tiles using maperitive, i got tiles but different names, so it will be very difficult for me to rename each one of file in case of large number of tiles for using the program as mentioned in link 1 posted by me.
-
- Download the map raw file.
- Use Maparative tool to generate the tiles (z/x/y.png)
- Use a .qrc file to manage your tiles.
- Setup your Map Plugin to read tiles from specific url
Plugin { id: mapPlugin name: "osm" PluginParameter { name: "osm.mapping.custom.host" value: "qrc:/YourTileDir/" } PluginParameter { name: "osm.mapping.providersrepository.disabled" value: true } }
- Setup your Map to accept a custom url type
Map { plugin: mapPlugin ... Component.onCompleted: { for( var i_type in supportedMapTypes ) { if( supportedMapTypes[i_type].name.localeCompare( "Custom URL Map" ) === 0 ) { activeMapType = supportedMapTypes[i_type] } } } }
-
@KillerSmath said in Qt offline maps using osm tiles:
- Use a .qrc file to manage your tiles.
better use the filesystem for this
-
@KillerSmath , Thank you for the suggestion, this does work.
@raven-worx , When I replace the "qrc:/YourTileDir/" with a local directory instead, this method does not work anymore for some reason.
Any ideas why?
-
@vpanchal said in Qt offline maps using osm tiles:
When I replace the "qrc:/YourTileDir/" with a local directory instead, this method does not work anymore for some reason.
replace with what exactly?
Did you use the file:/// url schema? -
@raven-worx Ah, I was missing the "file:///". Thank you very much.
-
@KillerSmath said in Qt offline maps using osm tiles:
stom URL M
Sorry about that but what is "Custom URL Map" ? is it a pathfile or folder name
-
Hello ..thanks for this information. I have tried as mentioned by @KillerSmath but after running my project I am getting following error.
QGeoTileRequestManager: Failed to fetch tile (510,340,10) 5 times, giving up. Last error message was: ':/offline_tiles/10/510/340.png cannot be opened: No such file or directory'
QGeoTileRequestManager: Failed to fetch tile (511,340,10) 5 times, giving up. Last error message was: ':/offline_tiles/10/511/340.png cannot be opened: No such file or directory'And I cannot see map on my Qt window.
Whether anyone else had same problem ?
or know what I am doing wrong ..Thank You :)
-