pelias / polygon-lookup

Fast point-in-polygon intersection for large numbers of polygons.
72 stars 17 forks source link

Option to limit or return all intersecting polygons #10

Closed uatuko closed 8 years ago

uatuko commented 8 years ago

Updated PolygonLookup.prototype.search() to include an optional limit parameter to limit or return all intersecting polygons as an array.

If a limit is not passed in (i.e. undefined) then the previous return data types are used making the change backwards compatible.

orangejulius commented 8 years ago

Wow, thanks @uditha-atukorala. Backwards compatible, nice new feature, wonderful tests. A+ pull request. LGTM

uatuko commented 8 years ago

Hey chaps, would be great if this can get merged and released to NPM 😃.

orangejulius commented 8 years ago

Hey @uditha-atukorala, to resolve the conflicts I've created a new PR with your changed rebased on master. I also notice the test cases were written as one test with a for loop handling all of them. While yours weren't bad at all, we've found this style can quickly get out of hand and lead to really unreadable tests. In the name of expediency I've rewritten them, it wasn't much work at all. Stay tuned over at #12, we'll be merging it shortly.