Skip to content

Instantly share code, notes, and snippets.

@alperdincer
Created February 20, 2012 06:56
Show Gist options
  • Save alperdincer/1868186 to your computer and use it in GitHub Desktop.
Save alperdincer/1868186 to your computer and use it in GitHub Desktop.
Leaflet and Wax on Multiple Layer Interaction problem with IE 7 and 8
var MKN = {};
MKN.Globals = {};
MKN.Map.startMapping = function () {
var baseMapJson = {
tilejson: '1.0.0',
scheme: 'xyz',
tiles: ['http://10.211.55.2/_temp_service/tiles/basemap/{z}/{x}/{y}.png']
};
var serviceLayerXJson = {
tilejson: '1.0.0',
scheme: 'xyz',
tiles: ['http://10.211.55.2/_temp_service/tiles/serviceLayerX/{z}/{x}/{y}.png'],
grids: ['http://10.211.55.2/_temp_service/grids/serviceLayerX/{z}/{x}/{y}.json'],
formatter: MKN.Map.showserviceLayerXTooltip
};
var serviceLayerYJson = {
tilejson: '1.0.0',
scheme: 'xyz',
tiles: ['http://10.211.55.2/_temp_service/tiles/serviceLayerY/{z}/{x}/{y}.png'],
grids: ['http://10.211.55.2/_temp_service/grids/serviceLayerY/{z}/{x}/{y}.json'],
formatter: MKN.Map.showserviceLayerYTooltip
};
var ilJson = {
tilejson: '1.0.0',
scheme: 'xyz',
tiles: ['http://10.211.55.2/_temp_service/tiles/serviceLayerZ/{z}/{x}/{y}.png'],
grids: ['http://10.211.55.2/_temp_service/grids/serviceLayerz/{z}/{x}/{y}.json'],
formatter: MKN.Map.showserviceLayerZTooltip
};
var baseMapLayer = new wax.leaf.connector(baseMapJson);
MKN.Globals.serviceLayerXLayer = new wax.leaf.connector(serviceLayerXJson);
MKN.Globals.serviceLayerYLayer = new wax.leaf.connector(serviceLayerYJson);
MKN.Globals.serviceLayerZLayer = new wax.leaf.connector(serviceLayerZJson);
MKN.Globals.mapObj = new L.Map('map_canvas', {center: new L.LatLng(38.7626503383, 35.936279296), zoom: 6, layers: [baseMapLayer], minZoom: 5, maxZoom: 13});
var infobox = new L.Control.InfoBox(); //sample div component to show tooltips on map
MKN.Globals.mapObj.addControl(infobox);
wax.leaf.interaction(MKN.Globals.mapObj, serviceLayerXJson);
wax.leaf.interaction(MKN.Globals.mapObj, serviceLayerYJson);
wax.leaf.interaction(MKN.Globals.mapObj, serviceLayerZJson);
}
MKN.Map.showserviceLayerXTooltip = function (options, data) {
var elem = document.getElementById('tooltip_serviceLayerX');
elem.innerHTML = '<b>X Name :</b> ' + data.name;
};
MKN.Map.showserviceLayerYTooltip = function (options, data) {
var elem = document.getElementById('tooltip_serviceLayerY');
elem.innerHTML = '<b>Y Name :</b> ' + data.name;
};
MKN.Map.showserviceLayerZTooltip = function (options, data) {
var elem = document.getElementById('tooltip_serviceLayerZ');
elem.innerHTML = '<b>Z Name :</b> ' + data.name;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment