On Saturday, February 16, 2013, Martin Friedrich <
mille...@googlemail.com> wrote:
> I am looking for a plugin or idea to search markers inside a placed polygon to get
> attributes of the markers back. Is there a solution in leaflet?
I think the closest thing to what you want that leaflet currently has is the "intersects" method in L.Bound.
You'll have to implement this yourself (and maybe make a plugin out of it?).
If the polygon of your problem is a triangle (or any other convex polygon), it is trivial. If it is not convex, you could do some preprocessing and calculate a rough triangulation of the polygon. Then it would be a matter of checking if the marker if inside of one of the triangles.
Another possibility is the "even-odd rule":
http://en.wikipedia.org/wiki/Point_in_polygonAlso, some days ago I saw a nice example of using leaflet+d3 which is related to this subject:
bounding box queries with quadtrees from d3
http://bl.ocks.org/calvinmetcalf/4963273And this plugin is also related:
https://github.com/kajic/leaflet-locationfilter/