Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why does layersWithin take a distance in pixels? #67

Open
lstomsl opened this issue Jun 5, 2017 · 3 comments
Open

Why does layersWithin take a distance in pixels? #67

lstomsl opened this issue Jun 5, 2017 · 3 comments
Labels

Comments

@lstomsl
Copy link

lstomsl commented Jun 5, 2017

I think this would be an extremely useful function if it took a search radius in meters. I have no idea how it is useful if it takes a search radius in screen pixels.

Am I missing something?

@leplatrem
Copy link
Collaborator

I think Leaflet has conversion functions from pixels to meters at the current zoom level (I did that somewhere already, but it was too long ago :))

I have no idea how it is useful if it takes a search radius in screen pixels.

It's useful for snapping for example :)

@haoliangyu
Copy link
Collaborator

haoliangyu commented Sep 25, 2017

@lstomsl

I am the developer of this function. As @leplatrem indicates, my original use case is to get layers within a bbox and select one of them for snapping in a custom filter function in our fork of Leaflet.Snap. A distance in pixels is used to provide a consistent user experience of snapping at different zoom levels.

I am fine with either meter or pixel as they are convertible: http://wiki.openstreetmap.org/wiki/Zoom_levels

@leplatrem
Copy link
Collaborator

We could add a layersWithinMeters() helper (As long as we don't go as far as implementing helpers for feets, yards, sticks, fingers or whatever crazy non metric unit 😄)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants