-
Notifications
You must be signed in to change notification settings - Fork 942
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
Feature Request: Support for FeatureCollection<MultiPoint> to first parameter of pointsWithinPolygon #2099
Comments
Good suggestion thanks @justinbangerter ! |
@micaminoff or @twelch - you've both expressed interest in helping out with TurfJS recently, this might good be a good first PR to tackle :) |
I can take this on. I'd like some feedback on the expected result. @justinbangerter what were you hoping for? Here's the current docs:
So the
The return value is more interesting depending on what you think the spirit of the function is, and whether the MultiPoint structure should be maintained or altered. For each MultiPoint input the function could:
I think the user can/should achieve 1 with the existing function by doing a |
I will trust your judgement here. My opinion is that 3 is the best. Or, if you wanted to keep the return type the same, that it would be best to return a collection of points. The need for this came from having a large geojson with MultiPoint features that I would like to filter in order to get a count of the points inside of the polygon. This worked fine with collections of Point features, which we (where I work) were using due to our need to use some extra metadata attached to the points. When we don't need that metadata, we use MultiPoint features, because they are smaller files. If you went with option 1, it would seem like a lot of unnecessary, extra processing to transform the object before passing it into the function, because the collection could be flattened afterward, too. I would think that, if you went for option 2, a more suitable name for the function might be "featuresWithinPolygon." |
@justinbangerter I appreciate the feedback. I do like 3. It's saying we want to input and return MultiPoint(s), but check and filter out points within them. This keeps with the original description of "Finds Points that fall within (Multi)Polygon(s)". Interestingly, solution 2 I think is as simple as adding an additional In the meantime, feedback from others welcome. |
Great. Yeah, I think that, if option 2 were implemented, it would not help me accomplish what I wanted to accomplish, which is: find the count of points in the polygon. |
PR is ready for review, implements option 3 |
This landed in master, not yet published |
Thanks for the awesome library.
The text was updated successfully, but these errors were encountered: