For some simple maps, I need to turn sublayer on and off. Like in the example (a) and (b) with Leaflet/Qgis2Web.

example map

  • Welcome to gis.stackexchange! Please note that a good question on this site is expected to show some degree of research on your part, i.e. what you have tried and - if applicable - code so far. For more info, you can check our faq.
    – underdark
    Aug 25 '18 at 10:23

3 methods that I know:

Use JavaScript and make a custom control, or check plugins to see if one fits.

Bring A and B in as separate layers by setting a filter in your JavaScript.

In QGIS, under the layer settings, provide a feature filter, using the query builder. Copy the layer twice in QGIS, use a separate feature filter for each layer, then run QGIS2WEB again.

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.