Qt offline maps using osm tiles
-
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 :)
-