Using QML map + osm not working?

I am currently using mapbox-gl-qml in my app, which is working fine, however I would like to try out the regular QML map with the OSM plugin. However I can’t seem to get it to work:

.pro:

QT += positioning location

.yaml:

Requires:
  - sailfishsilica-qt5 >= 0.10.9
  - qt5-plugin-geoservices-osm
  - qt5-qtlocation >= 5.2.0
  - qt5-qtdeclarative-import-location >= 5.2.0
  - qt5-qtdeclarative-import-positioning >= 5.2.0

.qml:

   Map {
      id: map
      anchors.fill: parent
      plugin: Plugin {
         id: osmPlugin
         name: "osm"
      }

      center: positionSource.position.coordinate
   }

This gives me a blank map, and after a while in the console I can see:

[W] unknown:0 - QGeoTileRequestManager: Failed to fetch tile (268,171,9) 5 times, giving up. Last error message was: 'Host otile1.mqcdn.com not found'
[W] unknown:0 - QGeoTileRequestManager: Failed to fetch tile (266,175,9) 5 times, giving up. Last error message was: 'Host otile1.mqcdn.com not found'
[W] unknown:0 - QGeoTileRequestManager: Failed to fetch tile (266,168,9) 5 times, giving up. Last error message was: 'Host otile1.mqcdn.com not found'
[W] unknown:0 - QGeoTileRequestManager: Failed to fetch tile (269,174,9) 5 times, giving up. Last error message was: 'Host otile1.mqcdn.com not found'
[W] unknown:0 - QGeoTileRequestManager: Failed to fetch tile (270,175,9) 5 times, giving up. Last error message was: 'Host otile1.mqcdn.com not found'
[W] unknown:0 - QGeoTileRequestManager: Failed to fetch tile (267,178,9) 5 times, giving up. Last error message was: 'Host otile1.mqcdn.com not found'
[W] unknown:0 - QGeoTileRequestManager: Failed to fetch tile (268,176,9) 5 times, giving up. Last error message was: 'Host otile1.mqcdn.com not found'
[W] unknown:0 - QGeoTileRequestManager: Failed to fetch tile (266,171,9) 5 times, giving up. Last error message was: 'Host otile1.mqcdn.com not found'
...

Is the OSM plugin no longer working? I would like to avoid that the users of my app need to sign up for an API key at the map provider, which only seems possible with OSM. Both HERE as well as Mapbox seem to require that one configures an API key for usage.

2 Likes

You would have to specify a server from which to load the tiles. Looks like old one doesn’t work anymore. How to do that for Qml.Map I don’t know

Theres APIs for setting that (Qt Location Open Street Map Plugin | Qt Location 5.15.5), however I am unsure what host to use. Currently trying to find one.

But seriously, this must be something like everyone how tries to compile the basic QML example is facing. How can this not already be discussed and solved like a thousand times? :thinking: I suppose its not even SFOS but QT related, unless more recent versions of QT already ship with different hosts and work out of the box :thinking:

[edit] And the API does not even seem to work. No matter what I set as "osm.mapping.host" (or osm.mapping.custom.host - the docs seem to be ambiguous here), I will always get errors complaining about otile1.mqcdn.com).

It is very old Qt that we use and you read Qt 5.15 manual. Search for manuals for Qt 5.6 (or maybe even 5.4 for Maps component).

Not a solution, but some more info. I have an app Rush Hour in OpenRepos which uses osm plugin. The app loads properly a map with J1 and JollaC having SFOS version 3.4.0.24. The app is not loading a map with XperiaX having the latest SFOS version 4.1.0.24. I try to update my JollaC to a newer version to see which version breaks my app.
As a note the qt5-qtlocation changes from 5.2.1 on the version 3.4.0.24 to 5.4.2 on the version 4.1.0.24.
EDIT ! Tested with JollaC and I can now confirm that the version 4.0.1.48 Koli breaks the app.

2 Likes