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 9 Oct 2018, 06:41 last edited by hem1 10 Sept 2018, 06:44
    #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 9 Oct 2018, 13:10 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 9 Oct 2018, 13:16
      0
      • J Jasur
        9 Oct 2018, 13:10

        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 9 Oct 2018, 13:16 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 26 Apr 2019, 20:05 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

          K 1 Reply Last reply 26 Apr 2019, 20:53
          0
          • V vpanchal
            26 Apr 2019, 20:05

            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

            K Offline
            K Offline
            KillerSmath
            wrote on 26 Apr 2019, 20:53 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

            R M 2 Replies Last reply 26 Apr 2019, 22:58
            3
            • K KillerSmath
              26 Apr 2019, 20:53

              @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]
                              }
                          }
                      }
                  }
              
              R Offline
              R Offline
              raven-worx
              Moderators
              wrote on 26 Apr 2019, 22:58 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 21 May 2019, 15:57 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?

                R 1 Reply Last reply 21 May 2019, 16:42
                0
                • V vpanchal
                  21 May 2019, 15:57

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

                  R Offline
                  R Offline
                  raven-worx
                  Moderators
                  wrote on 21 May 2019, 16:42 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 21 May 2019, 17:08
                  2
                  • R raven-worx
                    21 May 2019, 16:42

                    @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 21 May 2019, 17:08 last edited by
                    #9

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

                    P 1 Reply Last reply 5 Aug 2021, 19:24
                    0
                    • K KillerSmath
                      26 Apr 2019, 20:53

                      @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 24 May 2021, 12:17 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 28 May 2021, 11:40 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
                          21 May 2019, 17:08

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

                          P Offline
                          P Offline
                          PiBo
                          wrote on 5 Aug 2021, 19:24 last edited by PiBo 8 May 2021, 19:33
                          #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 6 Feb 2024, 02:10

                          • Login

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