Mapbox



  • Hey guys.

    I am trying to implement a map via the mapbox provider. The only real example I can find online for implementing a map is one that uses open street maps. When I try to run this example I just get a blank white window on my tablet. I have a feeling it may be because OSM no longer support unauthenticated tile access. Either way I am trying to get a mapbox map I have made working but I really am struggling. I have my token and map ID but not sure how to implement them. Do I need to install any dependencies? The documentation seems to point to it being built into QtLocation? Here is the example code I am trying

    import QtQuick 2.5
    import QtQuick.Window 2.2
    import QtQuick.Controls 1.3
    import QtQuick.Dialogs 1.2
    import QtPositioning 5.6
    import QtLocation 5.6
    
    Item
    {
            PositionSource
            {
                active:true
                onPositionChanged:
                {
                    console.log(position.coordinate)
                }
            }
            Map
            {
            id: map
            anchors.fill: parent
            plugin: Plugin { name: "mapbox" }
            zoomLevel: 15
            }
    
    }
    

    Does anybody have any experience with mapbox and embedding it into an app? if so some help would be greatly appreciated. The mapbox documention seems good but it lacks on the Qt side of things.

    Thanks!


  • Moderators

    @Scottish_Jason
    have you took a look at this?
    You need to pass your tokens as plugin parameters:

    Plugin { 
        name: "mapbox"
        PluginParameter { name: "mapbox.access_token"; value: "..." }
        PluginParameter { name: "mapbox.map_id"; value: "..." }
    }
    

    Also regarding OSM, see this QTBUG.



  • @raven-worx
    Hi there, thanks very much for your reply. I had been trying to figure out how to get those flags in there!
    The problem still seems to remain though. I just get a blank white screen.
    I do appear to be getting some linkage errors. Do I need to include ssl for this to work?

    W linker  : /data/data/org.qtproject.example.mapbox/qt-reserved-files/qml/QtQuick.2/libqtquick2plugin.so: is missing DT_SONAME will use basename as a replacement: "libqtquick2plugin.so"
    W linker  : /data/data/org.qtproject.example.mapbox/qt-reserved-files/qml/QtQuick/Window.2/libwindowplugin.so: is missing DT_SONAME will use basename as a replacement: "libwindowplugin.so"
    W linker  : /data/data/org.qtproject.example.mapbox/qt-reserved-files/qml/QtQuick/Controls/libqtquickcontrolsplugin.so: is missing DT_SONAME will use basename as a replacement: "libqtquickcontrolsplugin.so"
    W linker  : /data/data/org.qtproject.example.mapbox/qt-reserved-files/qml/QtQuick/Dialogs/libdialogplugin.so: is missing DT_SONAME will use basename as a replacement: "libdialogplugin.so"
    W linker  : /data/data/org.qtproject.example.mapbox/qt-reserved-files/qml/QtPositioning/libdeclarative_positioning.so: is missing DT_SONAME will use basename as a replacement: "libdeclarative_positioning.so"
    W linker  : /data/data/org.qtproject.example.mapbox/qt-reserved-files/qml/QtLocation/libdeclarative_location.so: is missing DT_SONAME will use basename as a replacement: "libdeclarative_location.so"
    W linker  : /data/data/org.qtproject.example.mapbox/qt-reserved-files/plugins/geoservices/libqtgeoservices_mapbox.so: is missing DT_SONAME will use basename as a replacement: "libqtgeoservices_mapbox.so"
    D QtPositioning: Regular updates using GPS 1000
    D QtPositioning: Looper Thread startup time in ms: 2
    D QtPositioning: Regular updates using network 1000
    W libmapbox.so: (null):0 ((null)): qt.network.ssl: QSslSocket: cannot resolve CRYPTO_free
    W libmapbox.so: (null):0 ((null)): qt.network.ssl: QSslSocket: cannot resolve EVP_CipherFinal
    W libmapbox.so: (null):0 ((null)): qt.network.ssl: QSslSocket: cannot resolve EVP_rc2_cbc
    W libmapbox.so: (null):0 ((null)): qt.network.ssl: QSslSocket: cannot resolve SSLv2_client_method
    W libmapbox.so: (null):0 ((null)): qt.network.ssl: QSslSocket: cannot resolve SSLv2_server_method
    W libmapbox.so: (null):0 ((null)): qt.network.ssl: QSslSocket: cannot resolve OPENSSL_add_all_algorithms_noconf
    W libmapbox.so: (null):0 ((null)): qt.network.ssl: QSslSocket: cannot resolve OPENSSL_add_all_algorithms_conf
    W libmapbox.so: (null):0 ((null)): qt.network.ssl: QSslSocket: cannot resolve EC_get_builtin_curves
    W libmapbox.so: (null):0 ((null)): qt.network.ssl: QSslSocket: cannot call unresolved function OPENSSL_add_all_algorithms_conf
    W libmapbox.so: (null):0 ((null)): qt.network.ssl: QSslSocket: cannot call unresolved function EC_get_builtin_curves
    W libmapbox.so: (null):0 ((null)): qt.network.ssl: QSslSocket: cannot call unresolved function EC_get_builtin_curves
    

    I am using Qt 5.7 and a google nexus tablet. I seemed to start getting linkage issues after changing from my phone to this tablet. I no longer have the phone.


  • Moderators

    @Scottish_Jason
    yep. You need to distribute the 2 OpenSSL libraries with your application.
    Or at least let it find it.



  • @raven-worx

    Ah I see.
    I managed to get the openssl library working on a desktop app I made by doing the following in my pro file and putting libssl32.dll and libeay32.dll in my root folder.

    win32
    {
        LIBS += -LC:/OpenSSL-Win32/lib -lubsec
        INCLUDEPATH += C:/OpenSSL-Win32/include
    }
    

    for android do I just need to add the openssl include folder as a resource?


  • Lifetime Qt Champion

    Hi,

    AFAIK, you'll have to provide OpenSSL yourself with your application. See here for instructions.



  • @SGaist

    Hi there. I did try and go through that material. As I am on windows I downloaded the msys application and tried to use it on a command prompt in the appropriate directory (as trying to run it standalone just pops up a quick command prompt which instantly disapears).. I appended the appropriate directories as per my current file system. No errors appeared after going through each step but still I am having no joy. Do you know of any more detailed webpages that give the steps for windows users?

    Also I did manage to get rid of the SSL errors it appears by linking to a pre-built ssl library in my pro file, but the problem still remains. I still have remaining linking issues it appears. Are these issues a problem or are they just warnings that do not matter?

    W linker  : /data/data/org.qtproject.example.mapbox/qt-reserved-files/qml/QtQuick.2/libqtquick2plugin.so: is missing DT_SONAME will use basename as a replacement: "libqtquick2plugin.so"
    W linker  : /data/data/org.qtproject.example.mapbox/qt-reserved-files/qml/QtQuick/Window.2/libwindowplugin.so: is missing DT_SONAME will use basename as a replacement: "libwindowplugin.so"
    W linker  : /data/data/org.qtproject.example.mapbox/qt-reserved-files/qml/QtQuick/Controls/libqtquickcontrolsplugin.so: is missing DT_SONAME will use basename as a replacement: "libqtquickcontrolsplugin.so"
    W linker  : /data/data/org.qtproject.example.mapbox/qt-reserved-files/qml/QtQuick/Dialogs/libdialogplugin.so: is missing DT_SONAME will use basename as a replacement: "libdialogplugin.so"
    W linker  : /data/data/org.qtproject.example.mapbox/qt-reserved-files/qml/QtPositioning/libdeclarative_positioning.so: is missing DT_SONAME will use basename as a replacement: "libdeclarative_positioning.so"
    W linker  : /data/data/org.qtproject.example.mapbox/qt-reserved-files/qml/QtLocation/libdeclarative_location.so: is missing DT_SONAME will use basename as a replacement: "libdeclarative_location.so"
    W linker  : /data/data/org.qtproject.example.mapbox/qt-reserved-files/plugins/geoservices/libqtgeoservices_mapbox.so: is missing DT_SONAME will use basename as a replacement: "libqtgeoservices_mapbox.so"
    

  • Lifetime Qt Champion

    AFAIK, that warning should be harmless. Do you see any other error message ?



  • This is the output I am getting when trying to run

    W System  : ClassLoader referenced unknown path:
    W linker  : /data/data/org.qtproject.example.mapbox/qt-reserved-files/plugins/platforms/android/libqtforandroid.so: is missing DT_SONAME will use basename as a replacement: "libqtforandroid.so"
    I Qt      : qt start
    W linker  : /data/data/org.qtproject.example.mapbox/qt-reserved-files/plugins/bearer/libqandroidbearer.so: is missing DT_SONAME will use basename as a replacement: "libqandroidbearer.so"
    W linker  : /data/data/org.qtproject.example.mapbox/qt-reserved-files/plugins/position/libqtposition_android.so: is missing DT_SONAME will use basename as a replacement: "libqtposition_android.so"
    I QtPositioning: Positioning start
    D         : (null):0 ((null)): QML debugging is enabled. Only use this in a safe environment.
    D OpenGLRenderer: Use EGL_SWAP_BEHAVIOR_PRESERVED: true
    I Adreno-EGL: <qeglDrvAPI_eglInitialize:379>: QUALCOMM Build: 10/21/15, 369a2ea, I96aee987eb
    I OpenGLRenderer: Initialized EGL, version 1.4
    
    W linker  : /data/data/org.qtproject.example.mapbox/qt-reserved-files/qml/QtQuick.2/libqtquick2plugin.so: is missing DT_SONAME will use basename as a replacement: "libqtquick2plugin.so"
    W linker  : /data/data/org.qtproject.example.mapbox/qt-reserved-files/qml/QtPositioning/libdeclarative_positioning.so: is missing DT_SONAME will use basename as a replacement: "libdeclarative_positioning.so"
    W linker  : /data/data/org.qtproject.example.mapbox/qt-reserved-files/qml/QtLocation/libdeclarative_location.so: is missing DT_SONAME will use basename as a replacement: "libdeclarative_location.so"
    W linker  : /data/data/org.qtproject.example.mapbox/qt-reserved-files/plugins/geoservices/libqtgeoservices_mapbox.so: is missing DT_SONAME will use basename as a replacement: "libqtgeoservices_mapbox.so"
    W linker  : /data/data/org.qtproject.example.mapbox/qt-reserved-files/plugins/imageformats/libqdds.so: is missing DT_SONAME will use basename as a replacement: "libqdds.so"
    W linker  : /data/data/org.qtproject.example.mapbox/qt-reserved-files/plugins/imageformats/libqgif.so: is missing DT_SONAME will use basename as a replacement: "libqgif.so"
    W linker  : /data/data/org.qtproject.example.mapbox/qt-reserved-files/plugins/imageformats/libqicns.so: is missing DT_SONAME will use basename as a replacement: "libqicns.so"
    W linker  : /data/data/org.qtproject.example.mapbox/qt-reserved-files/plugins/imageformats/libqico.so: is missing DT_SONAME will use basename as a replacement: "libqico.so"
    W linker  : /data/data/org.qtproject.example.mapbox/qt-reserved-files/plugins/imageformats/libqjpeg.so: is missing DT_SONAME will use basename as a replacement: "libqjpeg.so"
    W linker  : /data/data/org.qtproject.example.mapbox/qt-reserved-files/plugins/imageformats/libqtga.so: is missing DT_SONAME will use basename as a replacement: "libqtga.so"
    W linker  : /data/data/org.qtproject.example.mapbox/qt-reserved-files/plugins/imageformats/libqtiff.so: is missing DT_SONAME will use basename as a replacement: "libqtiff.so"
    W linker  : /data/data/org.qtproject.example.mapbox/qt-reserved-files/plugins/imageformats/libqwbmp.so: is missing DT_SONAME will use basename as a replacement: "libqwbmp.so"
    W linker  : /data/data/org.qtproject.example.mapbox/qt-reserved-files/plugins/imageformats/libqwebp.so: is missing DT_SONAME will use basename as a replacement: "libqwebp.so"
    

    and this is what i done to my pro file in order to test the precompiled library I found

    LIBS += -LC:\Users\Jason\Desktop\openssl-1.0.2\armeabi-v7a\lib
    
    INCLUDEPATH += C:\Users\Jason\Desktop\openssl-1.0.2\include\openssl
    

    Any help would be appreciated


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.