Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QML Mapbox "The geoservices provider is not supported"
Forum Updated to NodeBB v4.3 + New Features

QML Mapbox "The geoservices provider is not supported"

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 3 Posters 988 Views 1 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.
  • V Offline
    V Offline
    vcasado
    wrote on last edited by
    #1

    Dear Sirs,

    I am trying to develop an app with an embedded map, and I want to use Mapbox, starting from the OSM example "Minimal Map".

    The problem is that when I switch to Mapbox, i just receive "The geoservices provider is not supported"

    The QML file that I have is:

    import QtQuick
    import QtLocation
    import QtPositioning
    
    Window {
        width: Qt.platform.os == "android" ? Screen.width : 512
        height: Qt.platform.os == "android" ? Screen.height : 512
        visible: true
        title: map.center + " zoom " + map.zoomLevel.toFixed(3)
               + " min " + map.minimumZoomLevel + " max " + map.maximumZoomLevel
    
        Map {
            id: map
            anchors.fill: parent
            center: QtPositioning.coordinate(-3.695233, 40.602505) // Bewatt
            zoomLevel: 24
            property geoCoordinate startCentroid
    
            plugin: Plugin {
                name: "mapbox"
                PluginParameter {
                    name: "mapboxgl.mapping.cache.memory"
                    value: true
                }
                PluginParameter {
                      name: "mapbox.access_token"
                      value: "XXXXX"
                }
                PluginParameter {
                      name: "osm.routing.host"
                      value: "https://valhalla1.openstreetmap.de/"
                }
                PluginParameter {
                   name: "mapbox.mapping.highdpi_tiles"
                   value: true
                }
            }
    
            PinchHandler {
                id: pinch
                target: null
                onActiveChanged: if (active) {
                    map.startCentroid = map.toCoordinate(pinch.centroid.position, false)
                }
                onScaleChanged: (delta) => {
                    map.zoomLevel += Math.log2(delta)
                    map.alignCoordinateToPoint(map.startCentroid, pinch.centroid.position)
                }
                onRotationChanged: (delta) => {
                    map.bearing -= delta
                    map.alignCoordinateToPoint(map.startCentroid, pinch.centroid.position)
                }
                grabPermissions: PointerHandler.TakeOverForbidden
            }
            WheelHandler {
                id: wheel
                acceptedDevices: Qt.platform.pluginName === "cocoa" || Qt.platform.pluginName === "wayland"
                                 ? PointerDevice.Mouse | PointerDevice.TouchPad
                                 : PointerDevice.Mouse
                rotationScale: 1/120
                property: "zoomLevel"
            }
            DragHandler {
                id: drag
                target: null
                onTranslationChanged: (delta) => map.pan(-delta.x, -delta.y)
            }
            Shortcut {
                enabled: map.zoomLevel < map.maximumZoomLevel
                sequence: StandardKey.ZoomIn
                onActivated: map.zoomLevel = Math.round(map.zoomLevel + 1)
            }
            Shortcut {
                enabled: map.zoomLevel > map.minimumZoomLevel
                sequence: StandardKey.ZoomOut
                onActivated: map.zoomLevel = Math.round(map.zoomLevel - 1)
            }
        }
    
        RouteModel {
            id: routeModel
    
            autoUpdate: true
            query: routeQuery
    
            plugin: Plugin {
                name: "mapbox"
    
                // Development access token, do not use in production.
                PluginParameter {
                    name: "mapbox.access_token"
                    value: "XXXXXX"
                }
            }
    
            Component.onCompleted: {
                if (map) {
                    map.updateRoute();
                }
            }
        }
    
        RouteQuery {
            id: routeQuery
        }
    }
    

    CMakeLists.txt:

    # Generated from minimal_map.pro.
    
    cmake_minimum_required(VERSION 3.16)
    project(minimal_map LANGUAGES CXX)
    
    set(CMAKE_INCLUDE_CURRENT_DIR ON)
    
    set(CMAKE_AUTOMOC ON)
    set(CMAKE_AUTORCC ON)
    set(CMAKE_AUTOUIC ON)
    
    if(NOT DEFINED INSTALL_EXAMPLESDIR)
      set(INSTALL_EXAMPLESDIR "examples")
    endif()
    
    set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/location/minimal_map")
    
    find_package(Qt6 COMPONENTS Core Gui Location Qml Positioning Sql OpenGL)
    
    qt_add_executable(minimal_map WIN32 MACOSX_BUNDLE
        main.cpp
    )
    target_link_libraries(minimal_map PUBLIC
        Qt::Core
        Qt::Gui
        Qt::Location
        Qt::Qml
        Qt::Positioning
        Qt::Sql
        Qt::OpenGL
    )
    
    
    # Resources:
    set(qml_resource_files
        "main.qml"
    )
    
    qt6_add_resources(minimal_map "qml"
        PREFIX
            "/"
        FILES
            ${qml_resource_files}
    )
    
    install(TARGETS minimal_map
        RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
        BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
        LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
    )
    

    Main.cpp:

    // Copyright (C) 2017 The Qt Company Ltd.
    // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
    
    #include <QGuiApplication>
    #include <QQmlApplicationEngine>
    
    int main(int argc, char *argv[])
    {
        QGuiApplication app(argc, argv);
    
        QQmlApplicationEngine engine;
        engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
    
        return app.exec();
    }
    

    Thank you so much

    1 Reply Last reply
    0
    • L Offline
      L Offline
      loiczimmermann
      wrote on last edited by
      #2

      I have exactly the same issue with Qt6.5.2,

      Have you found some solution since the time you created the post ?

      1 Reply Last reply
      0
      • JKSHJ Offline
        JKSHJ Offline
        JKSH
        Moderators
        wrote on last edited by
        #3

        Qt 6 will not support the Mapbox backend. See the section "Reducing the number of included backends" at https://www.qt.io/blog/the-road-to-qt-location

        Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

        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