4

I have geojson file including boundaries of most countries in world.

When I clicked on a "feature" (aka country, or polygon) I want to hide it while keep showing the others. because I am planing to showing more detailed geojson (states, cities) for that clicked country.

I am planning to use Leaflet JS, but I am open to any other libraries as well.

===================

This is the first screen, apply the world countries boundaries. enter image description here

This is after clicking somewhere on map, I added to US boundaries geoJson to main map variable.

enter image description here

As you can see, I put US geojson upon the world geojson (you can realize that there is still some green area(which comes from world geojson) on the top left part of USA).

What i want is to hide only clicked country, USA in this case, and show more detailed geojson belong to that country.

PS: I dont use tiles, I need to clarify countries by geojson

  • Could you clarify what your problem is and add some context? What have you tried already? – Martin Sep 1 '14 at 12:34
5

Leaflet has a useful filter function that could easily be triggered based on some event.

Alternatively, mapbox.js which is built on top of leaflet, has a useful setFilter function that you can apply to the a geojson feature layer.

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.