Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Qt offline maps using osm tiles
QtWS25 Last Chance

Qt offline maps using osm tiles

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
qmlmapofflineqtlocationosm
12 Posts 8 Posters 9.7k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    hem1
    wrote on last edited by hem1
    #1

    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

    https://myembeddeddiary.wordpress.com/2016/08/18/building-offline-maps-in-qt-without-any-servertile-server-direct-offline-map-using-file-protocol/

    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

    1 Reply Last reply
    1
    • J Offline
      J Offline
      Jasur
      wrote on last edited by
      #2

      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

      H 1 Reply Last reply
      0
      • J 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,
        Jasur

        H Offline
        H Offline
        hem1
        wrote on last edited by
        #3

        @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.

        1 Reply Last reply
        0
        • V Offline
          V Offline
          vpanchal
          wrote on last edited by
          #4

          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

          KillerSmathK 1 Reply Last reply
          0
          • V vpanchal

            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

            KillerSmathK Offline
            KillerSmathK Offline
            KillerSmath
            wrote on last edited by KillerSmath
            #5

            @vpanchal

            1. Download the map raw file.
            2. Use Maparative tool to generate the tiles (z/x/y.png)
            3. Use a .qrc file to manage your tiles.
            4. 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
                    }
                }
            
            1. 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]
                            }
                        }
                    }
                }
            

            @Computer Science Student - Brazil
            Web Developer and Researcher
            “Sometimes it’s the people no one imagines anything of who do the things that no one can imagine.” - Alan Turing

            raven-worxR M 2 Replies Last reply
            3
            • KillerSmathK KillerSmath

              @vpanchal

              1. Download the map raw file.
              2. Use Maparative tool to generate the tiles (z/x/y.png)
              3. Use a .qrc file to manage your tiles.
              4. 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
                      }
                  }
              
              1. 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]
                              }
                          }
                      }
                  }
              
              raven-worxR Offline
              raven-worxR Offline
              raven-worx
              Moderators
              wrote on last edited by
              #6

              @KillerSmath said in Qt offline maps using osm tiles:

              1. Use a .qrc file to manage your tiles.

              better use the filesystem for this

              --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
              If you have a question please use the forum so others can benefit from the solution in the future

              1 Reply Last reply
              3
              • V Offline
                V Offline
                vpanchal
                wrote on last edited by
                #7

                @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?

                raven-worxR 1 Reply Last reply
                0
                • V vpanchal

                  @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?

                  raven-worxR Offline
                  raven-worxR Offline
                  raven-worx
                  Moderators
                  wrote on last edited by
                  #8

                  @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?

                  --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
                  If you have a question please use the forum so others can benefit from the solution in the future

                  V 1 Reply Last reply
                  2
                  • raven-worxR raven-worx

                    @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?

                    V Offline
                    V Offline
                    vpanchal
                    wrote on last edited by
                    #9

                    @raven-worx Ah, I was missing the "file:///". Thank you very much.

                    P 1 Reply Last reply
                    0
                    • KillerSmathK KillerSmath

                      @vpanchal

                      1. Download the map raw file.
                      2. Use Maparative tool to generate the tiles (z/x/y.png)
                      3. Use a .qrc file to manage your tiles.
                      4. 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
                              }
                          }
                      
                      1. 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]
                                      }
                                  }
                              }
                          }
                      
                      M Offline
                      M Offline
                      musty
                      wrote on last edited by
                      #10

                      @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

                      1 Reply Last reply
                      0
                      • S Offline
                        S Offline
                        saurabh162
                        wrote on last edited by saurabh162
                        #11

                        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 :)

                        1 Reply Last reply
                        0
                        • V vpanchal

                          @raven-worx Ah, I was missing the "file:///". Thank you very much.

                          P Offline
                          P Offline
                          PiBo
                          wrote on last edited by PiBo
                          #12

                          @vpanchal
                          @raven-worx

                          Hi I've tried:
                          file:///home/dev/Downloads/OsmOffline/offline_tiles/

                          This does not work. Am I doing something wrong?

                          Did it work for you?

                          1 Reply Last reply
                          0
                          • JKSHJ JKSH referenced this topic on

                          • Login

                          • Login or register to search.
                          • First post
                            Last post
                          0
                          • Categories
                          • Recent
                          • Tags
                          • Popular
                          • Users
                          • Groups
                          • Search
                          • Get Qt Extensions
                          • Unsolved