1

In Leaflet I want to add a legend when I turn on an overlay, then when I turn off that overlay I want the legend to disappear and when I turn on a second overlay I want a second legend to appear. I have 2 png legends that I am using. I'm using 'overlayadd' & 'overlayremove' but can't get it working

  • What software are you using on your project? – Ale Oct 14 '14 at 10:20
  • I am using QGIS – Nicolas Monk Oct 14 '14 at 18:03
1

Perhaps use DOM methods to replace the contents of the div. http://leafletjs.com/examples/choropleth.html look at the info.update function which sets the innerHTML.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.