Leaflet author here. The vectors should redraw properly. The quote by @nathansnider is referring to the fact that vectors are not reprojected, but they animate with a CSS transform during animation. If they don't redraw, you should set up a JSFiddle test case and file an issue on GitHub.
update: they currently redraw, but are not reprojected until the animation is over as of beta 2. We want to change it so that vectors are reprojected at least per round zoom, or once per a certain interval of time (e.g. 200ms), which should be a good compromise between performance and visual appearance.
This is not trivial, due to how web browsers handle DOM elements. If you have two (or more) overlapping (not nested) elements, pointer events will only apply to the top-most element. This is a limitation of the DOM model.
Two approaches to the problem spring to mind:
1 - Use GIS magic to calculate the intersection of all your different features. Create a feature layer with small polygons, each of which contains the properties of all your 4 feature layers.
i.e. each polygon should contain information about schools, counties, cities and misc; and each combination of schools, counties, cities and misc has its own polygon.
2 - Use something like Leaflet.CheapLayerAt
to automate querying displayed vector data on the screen. When the user clicks on a feature on the map, remove that feature layer, run a Leaflet.CheapLayerAt
query. That should return the feature from the underlying feature layer. Repeat this process until no more features are found, then re-add all the feature layers.
Yes, if you use this method you must remove and add layers. Or send them to the back of the stacking context so other layer is the top-most one when querying again.
Best Answer
In the case of raster layers being
L.imageOverlay
's, you must have instantiated them specifying the image bounds.If for any reason you lost reference of these bounds, you can retrieve them using
myImageOverlay._bounds
.We could even imagine extending the
L.ImageOverlay
class to include agetBounds()
method, so that it becomes compatible when embedded in a Feature Group with the latter owngetBounds()
method: