I am new to Leaflet as well as Javascript.
Currently, I am trying to create a spatial index of library holdings for old topographic maps that people can access and download online. The source of the features is a GeoJSON file.
The problem is that the school library has multiple types of the same map over the years, but when I click on a map, only one popup shows up. I want the option to cycle through multiple maps, but I am unsure on how to approach the problem.
Is there a special term in the local jargon for cycling through overlapping polygons, or is there a stronger approach to this problem?
Best Answer
One option would be to use leaflet point in poly (leaflet.pip) which is available through Mapbox: https://www.mapbox.com/mapbox.js/example/v1.0.0/point-in-polygon/ Or as a leaflet plugin: https://github.com/mapbox/leaflet-pip
The fiddle here: http://jsfiddle.net/TnX96/136/ will show exactly how this would work. Or see the code below....
HTML be sure to include the PIP library:
Javascript: