Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Web and WebWorks Development

Posts: 499
Registered: ‎06-24-2008
My Device: Not Specified

Leaflet polylines on BB10 devices

Has anyone successfully used Leaflet with BB10?


There's an example in the Webworks Samples repository, and I was able to load a map without issues, but when I try and draw a polyline on the map, I'm not successful.


I can draw the line, but no matter what I try the map always overlays the line. Even waiting on load for the tile layer before drawing the line doesn't work. 



Here's what I'm trying now...


lMap = L.map('map_canvas').setView([this.currentPosition.coords.latitude, this.currentPosition.coords.longitude], 19);

var layer = L.tileLayer('http://{s}.tile.cloudmade.com/--key--/82688@2x/256/{z}/{x}/{y}.png', {
attribution: 'Map data &copy; <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, <a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, Imagery © <a href="http://cloudmade.com">CloudMade</a>',
maxZoom: 19,
zindex: 10

layer.on('load', function(e){
var coords = getCoords();
pl = new L.Polyline(coords,{color: 'blue', weight: 3, opacity: 0.5, smoothFactor: 1, zindex: 20}).addTo(lMap);