1

So I'm working on a map using leaflet and I want to use custom check boxes, not the default controls. I'm returning the correct json information when I check the boxes. I'm just not sure how to swap out the json reference and trigger marker refresh. Any thoughts would be welcome. The project can be seen here: https://codepen.io/sharperwebdev/pen/PQvMqR?editors=1010

Basically what I'm asking is how do I swap out the original geoJSON for a reduced version on an external (outwith the map) click event.

1

You might want to create a layergroup and add/remove data from your layer as you filter them. Look at the source code for http://www.gistechsolutions.com/leaflet/DEMO/filter/filter.html I have an initial load of the data, then from my radio buttons I add and remove the layers data as checked.

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.