Qt offline maps using osm tiles
-
wrote on 9 Oct 2018, 06:41 last edited by hem1 10 Sept 2018, 06:44
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
-
wrote on 9 Oct 2018, 13:10 last edited by
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 -
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,
Jasurwrote on 9 Oct 2018, 13:16 last edited by@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.
-
wrote on 26 Apr 2019, 20:05 last edited by
Hi Hem,
Have you come across a solution for this? I am in the same boat as you. Please share if you have found a work-around solution.
Thanks,
Vishal -
Hi Hem,
Have you come across a solution for this? I am in the same boat as you. Please share if you have found a work-around solution.
Thanks,
Vishalwrote on 26 Apr 2019, 20:53 last edited by KillerSmath- 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] } } } }
-
- 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
-
wrote on 21 May 2019, 15:57 last edited by
@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?
-
@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? -
@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?wrote on 21 May 2019, 17:08 last edited by@raven-worx Ah, I was missing the "file:///". Thank you very much.
-
- 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] } } } }
wrote on 24 May 2021, 12:17 last edited by@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
-
wrote on 28 May 2021, 11:40 last edited by saurabh162
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 :)
-
@raven-worx Ah, I was missing the "file:///". Thank you very much.
wrote on 5 Aug 2021, 19:24 last edited by PiBo 8 May 2021, 19:33Hi I've tried:
file:///home/dev/Downloads/OsmOffline/offline_tiles/This does not work. Am I doing something wrong?
Did it work for you?
-
J JKSH referenced this topic on 6 Feb 2024, 02:10