Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

QML Mapbox with custom sprite



  • Hi.

    I am struggling using a custom sprite with Mapbox.
    My custom sprite and json descriptions are available online, i added this

    MapParameter {
        type: "image"
    
        property var name: "mySprite"
        property var sprite: "https://url-to-sprite"
    }
    

    and later use it in a style-layer with a layout

    MapParameter {
        id: mylocationlayout
        type: "layout"
    
        property var layer: "myLocationLayer"
        property var iconImage: "myicon"
    }
    

    it gives me:

    [ ERROR ]  "{unknown}[Style]: Failed to load sprite: HTTP status code 404"
    

    ok, it cannot find the sprite, but why? and how to make it work?
    the same url is also used in the mapbox-style itself...

    i am not sure with that "sprite" property, and also tried "url", with the same result.

    thanks for any help



  • I ended up not using online-sprites but load the sprites in QML:

    MapParameter {
        type: "image"
        property var name: "mySprite"
        property var sprite: ":/path_to_iamge_in_resources"
    }
    

    using it in a layout like this:

    MapParameter {
        type: "layout"
        property var layer: "myLayer"
    
        property var iconImage: "mySprite"
    }
    


  • I ended up not using online-sprites but load the sprites in QML:

    MapParameter {
        type: "image"
        property var name: "mySprite"
        property var sprite: ":/path_to_iamge_in_resources"
    }
    

    using it in a layout like this:

    MapParameter {
        type: "layout"
        property var layer: "myLayer"
    
        property var iconImage: "mySprite"
    }
    

Log in to reply