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. OSM offline : mbtile server not working
Forum Updated to NodeBB v4.3 + New Features

OSM offline : mbtile server not working

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
3 Posts 2 Posters 2.1k Views 2 Watching
  • 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.
  • KartK Offline
    KartK Offline
    Kart
    wrote on last edited by
    #1

    I have downloaded the mbtile map file from here.
    I have used the following the in the qml

    import QtQuick 2.7
    import QtQuick.Window 2.2
    import QtLocation 5.8
    Window {
        id: win
        visible: true
        width: 640
        height: 480
        title: qsTr("test map view")
        Map {
            id:map
            anchors.fill: parent
            activeMapType: map.supportedMapTypes[supportedMapTypes.length - 1]
            zoomLevel: 1
            center {
                    latitude: 13.0827
                    longitude: 80.2707
            }
            plugin: Plugin {
                    name: "osm"
                          PluginParameter { name: "osm.useragent";value: "MyOSM" }
                          PluginParameter { name: "osm.mapping.custom.host";value: "http://127.0.0.1:8080/"}
                          PluginParameter { name: "osm.mapping.copyright"; value: "OSM" }
                          PluginParameter { name: "osm.mapping.cache.directory"; value: "/home/karthi/Qt/qtilestream-master/cache_folder" }
                          PluginParameter { name: "osm.mapping.providersrepository.disabled";value: true}
    
            }
    
         }
    }
    
    

    I am running tile server on the local host and port 8080. But i am getting a blank screen with no map loaded. Am i missing something ?

    1 Reply Last reply
    0
    • O Offline
      O Offline
      osmial
      wrote on last edited by osmial
      #2

      Hi @name_qt,

      I had some problems with displaying maps (don't remember now what exactly was the issue about) and adding this code helped:

      Map {
              [...]
              Component.onCompleted: {
                  for( var i_type in supportedMapTypes ) {
                      if( supportedMapTypes[i_type].name.localeCompare( "Custom URL Map" ) === 0 ) {
                          activeMapType = supportedMapTypes[i_type]
                      }
                  }
              }
      }
      

      I think I had to add it when I was playing with different set-up of osm.mapping.host and osm.mapping.custom.host fields.

      KartK 1 Reply Last reply
      0
      • O osmial

        Hi @name_qt,

        I had some problems with displaying maps (don't remember now what exactly was the issue about) and adding this code helped:

        Map {
                [...]
                Component.onCompleted: {
                    for( var i_type in supportedMapTypes ) {
                        if( supportedMapTypes[i_type].name.localeCompare( "Custom URL Map" ) === 0 ) {
                            activeMapType = supportedMapTypes[i_type]
                        }
                    }
                }
        }
        

        I think I had to add it when I was playing with different set-up of osm.mapping.host and osm.mapping.custom.host fields.

        KartK Offline
        KartK Offline
        Kart
        wrote on last edited by Kart
        #3

        Thanks for your response @osmial.
        I believe the supported maptype id is 7 for custom maps. 0-6 will give the in build maptypes. That is why i gave like this

        map.supportedMapTypes[supportedMapTypes.length - 1]
        

        I did also check with your code and i had the same result. I checked with

        console.log(i_type);
        

        and it is giving 7.

        The application is running, but the map is blank.

        1 Reply Last reply
        0

        • Login

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