Saturday, 24 August 2013

Enjoyjs, leaflet and markercluster

Enjoyjs, leaflet and markercluster

I´m trying to write an application using enjoyjs, leafglet and the leaflet
plugin markercluster.
leaflet is working fine, but markercluster gives me the error:
Reference error: L is not defined L.MarkerClusterGroup =
L.FeatureGroup.extend({
in /markercluster/dist/leaflet.markercluster-src.js
And then TypeError: L.MarkerClusterGroup is not a constructor in my js
The js is loaded and the css (checked with firebug). If i create a marker
it works fine.
Where or how must i ibclude this plugin to make it work?
this is my kind
enyo.kind({ name: "mapContainer",
published: {
map: null,
mi_lat: 44.981014,
mi_lng: -93.270520,
zoom_actual: 16,
zoom_max: 18
},
rendered: function(){
this.inherited(arguments);
//Initialize the map
this.map = L.map(this.id,{
center: [this.mi_lat, this.mi_lng],
zoom: this.zoom_actual,
maxZoom: this.zoom_max,
});
L.tileLayer("http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",
{attribution: "Map data © OpenStreetMap contributors"}
).addTo(this.map);
var markersLayer = new L.MarkerClusterGroup();
//Initilize the marker and popup
var mark = new L.marker([44.981014, -93.270520]).addTo(this.map);
var popDiv = L.DomUtil.create("div");
var pop = new L.popup();
mark.bindPopup(pop);
},
});
Thank you very much for your help

No comments:

Post a Comment