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

added bbox test #3

Merged
merged 3 commits into from
Oct 13, 2016
Merged

added bbox test #3

merged 3 commits into from
Oct 13, 2016

Conversation

tcql
Copy link
Contributor

@tcql tcql commented Nov 23, 2015

querying with a bbox returns properties for all polygons that it touches.

If there's only one hit, just the match is returned instead of an array.

still exposed the rbush tree, in case anybody using which-polygon requires additional access.

@mourner
Copy link
Member

mourner commented Nov 23, 2015

This may be a bit confusing since you do checks against geometry in polygon tests, but don't do it with bbox. So maybe it's not worth exposing as a public query method, because users would expect it to behave properly.

@tcql
Copy link
Contributor Author

tcql commented Nov 23, 2015

oh good point. I kind of spaced out and threw this together real fast. We could use lineclip to figure out if the polygons actually intersect (or use point in polygon to detect if the bbox is entirely inside a polygon)

@tcql
Copy link
Contributor Author

tcql commented Nov 23, 2015

@mourner updated to use lineclip to validate matches

return false;
}).map(function (el) {
return el[5];
});
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's use a simple loop like in query instead of two filter/map closures for consistency.

@tcql
Copy link
Contributor Author

tcql commented Nov 24, 2015

updated 👍

@mourner
Copy link
Member

mourner commented Oct 13, 2016

@tcql @ingalls Rebased against master and was about to merge, but just realized that the bbox check is not always correct. One counter-case that comes to mind is when bbox center is inside a hole which is fully contained within the bbox. Then bbox intersects the polygon, while the outer ring doesn't intersect the bbox. This needs another thought...

@mourner mourner merged commit b65e2ba into master Oct 13, 2016
@mourner mourner deleted the bbox branch October 13, 2016 11:18
@mourner
Copy link
Member

mourner commented Oct 13, 2016

Fixed the edge case above and published as 2.1.0.

@ingalls
Copy link

ingalls commented Oct 15, 2016

Thanks a ton @mourner ! Will get the mbtiles-extrats PR updated to point at this version.

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

Successfully merging this pull request may close these issues.

None yet

3 participants