I am currently working on modifying the store locator template from MapBox: https://github.com/mapbox/foursquare-store-locator https://www.mapbox.com/blog/foursquare-store-locator/
The problem is in adding a linestring/polyline to this modified framework.
For example, I am not able to add a new map layer with the linestring GeoJSON data using this format:
L.map('map').
I can get the linestring to work with leafllet.js:
http://jsfiddle.net/xpancom/hUy5g/16/
...but this utilizes the "L." from leaflet.js and doesn't work in the modified MapBox template.
L.geoJson(myLine1, {style: myStyle}).addTo(map);
The problem is the modified store locator app from MapBox doesn't appear to implement this same interface.
Here is my current code that attempts to add the layer that has the linestrings:
foursquare.lines = function() {
var lines = { 'type': 'FeatureCollection',
'features': []
};
lines.features.push({
type: 'Feature',
// id: venue.id,
geometry: {
type: 'LineString',
coordinates: [[
60.317769,
24.929009
],
[
24.9292486208828,
60.1681323558666
],
[
24.951764345169067,
60.168932342858554
],
[
24.93321418762207,
60.16911913731421
],
[
24.952929,
60.167312
],
[
24.944114685058594,
60.170111798603266
],
[
24.94499444961548,
60.171435300334004
]]
},
properties: {}
}); //push
//console.log(lines);
if (MM_map.lineLayer) {
MM_map.lineLayer.geojson(lines);
alert("hi");
} else {
MM_map.lineLayer = mmg().geojson(lines);
//alert("hello");
console.log(lines);
}
MM_map.addLayer(MM_map.lineLayer);
}; //foursquare.lines
The layer gets added as an empty div but the geojson and the lines object don't get processed and don't show.
When I run console.log(lines) I get all the geojson data correctly it just doesn't get added using this line:
mmg().geojson(lines)
I really appreaciate any help on this. Thanks