How to create a layer switcher in leaflet
I had used the following layers in leaflet,now i want to switch between
the 4 layers ,please tell the code to create a layer switcher control in
leaflet
// night layer //var osmUrl =
'http://{s}.tile.cloudmade.com/a7db5562d0cd4fe0a2d8983fbb3b5519/999/256/{z}/{x}/{y}.png',
//golden layer var osmUrl =
'http://{s}.tile.cloudmade.com/a7db5562d0cd4fe0a2d8983fbb3b5519/997/256/{z}/{x}/{y}.png'
//black layer //var osmUrl =
'http://{s}.tile.stamen.com/toner/{z}/{x}/{y}.png',
osmAttribution = 'Map data © 2012 OpenStreetMap contributors', osm = new
L.TileLayer(osmUrl, {maxZoom: 18, attribution: osmAttribution});
No comments:
Post a Comment