-
Notifications
You must be signed in to change notification settings - Fork 15
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
radius=0 leads to zero results with PIP #36
Comments
Per chat with @flippmoke we've got a relatively solid solution for this problem. Basically, closest_point won't work for point in polygon use-cases if we work in integer space. In the name of cleanliness and performance, point-in-polygon should probably be a different code path or method entirely. Before we split them apart, here's the route I'll go down:
Once we get this working, splitting the code paths out into two methods could be helpful, giving the implementers (JS devs) opportunity to use two different methods depending on their needs. For example: // current radius-based query
vtquery.closest(tiles, ll, options, cb);
// point in polygon method
// (since the implement will know if they are working with radius=0)
// probably work within doubles space and only worry about polygons
vtquery.within(tile, ll, options, cb);
// OR - if we are dealing with integer space and want to
// return points/polylines as possible features
vtquery.intersects(tile, ll, options, cb); |
Radius |
When radius is
0
, we expect point in polygon style results (ie 1 result if we’re within a single polygon). Right now we get zero results since the query point is a double (lng lat) but by the time we’re comparing the distance from closest_point we’re in integers, which then get converted to a lng lat and can be different than the original query point since it’s an interpolation. This means the distance check looks something likeif (0.00011241241 <= 0) { ... }
which evaluates to false.Three possible solutions:
if (0.0000234 < 0.5)
to catch these instancescc @flippmoke
The text was updated successfully, but these errors were encountered: