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. QML Mapbox with custom sprite
Forum Updated to NodeBB v4.3 + New Features

QML Mapbox with custom sprite

Scheduled Pinned Locked Moved Solved QML and Qt Quick
2 Posts 1 Posters 271 Views
  • 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.
  • I Offline
    I Offline
    i.n.g.o.
    wrote on 6 May 2019, 04:44 last edited by
    #1

    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

    1 Reply Last reply
    0
    • I Offline
      I Offline
      i.n.g.o.
      wrote on 2 Aug 2019, 11:48 last edited by
      #2

      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"
      }
      
      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