Thread: [SailfishOS] Mapbox GL Native QML plugin
View Single Post
Posts: 1,414 | Thanked: 7,547 times | Joined on Aug 2016 @ Estonia
#47
Originally Posted by jdrescher View Post
I'm sorry, but I have an other question.
I want to place an image on the map. I looked into the api and also in the sources of poor maps GL and came up with this:
Code:
map.addImagePath("image", Qt.resolvedUrl(app.getIcon("./images/position.png")))

map.addLayer("image_layer", {"type": "symbol", "source": "source_name"});
map.setLayoutProperty(constants.layerStill, "icon-image", "image");
map.setLayoutProperty(constants.layerStill, "icon-size", 1.0 / map.pixelRatio);
map.setLayoutProperty(constants.layerStill, "visibility", "visible");
There is no error but also no icon on the map. It's also unclear where do I have to put the coordinates?
You are very close. You are just missing definition of the source - "source_name". Example would be here: https://github.com/rinigus/poor-maps...Marker.qml#L42

So, in your code, before adding a layer using the source, you have to add source as well:

Code:
map.addSourcePoint("source_name",  some_coordinate)
Later you can modify its location by corresponding API functions and don't have to do anything with the layers.

PS: Its frequent when Mapbox GL doesn't give any decent feedback in terms of errors, unfortunately.
 

The Following 4 Users Say Thank You to rinigus For This Useful Post: