-
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
Additional @turf/concave
refactoring
#907
Conversation
- replaced turf-union with geojson-dissolve; - updated and added tests; - updated bench and readme;
Hey @stebogit That
Im sure either the geojson-dissolve or concaveman approaches will be a big improvement! |
🎉 Woot! 👍
👍 Better to keep it similar to the same implementation, if one wants to use
👍 Sounds like a plan!
👍 Sounds good, this shouldn't be an error. An error should be caused when you are misusing the module (which isn't the case). Question/Proposal (not immediate to this PR)
If we are replacing Also, what's the difference between |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 I'm really liking geojson-dissolve, pretty neat library!
packages/turf-concave/package.json
Outdated
"Denis Carriere <@DenisCarriere>", | ||
"Stefano Borghi <@stebogit>", | ||
"Rowan Winsemius <@rowanwins>", | ||
"Daniel Pulido <@dpmcmlxxvi>" | ||
], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would also include the Authors/Contributors of geojson-dissolve
.
- Stephen Whitmore @noffle
- Gregor MacLennan @gmaclennan
Nice, someone else is using our code. ❤️ It's worth noting that |
packages/turf-concave/index.js
Outdated
function removeDuplicates(points) { | ||
var cleaned = []; | ||
var existing = {}; | ||
points.features.forEach(function (pt) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 This syntax looked so familiar that I thought I wrote this part :)
https://github.com/Turfjs/turf/blob/master/packages/turf-clean-coords/index.js#L52-L58
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes! I told you it was sooo smart! 😄
Also include Polygon or MultiPolygon as valid output
@noffle You're code is awesome! 👍 You've got a new fan boy for you're many awesome repos in Digital Democracy.
We will add Mike Bostock @mbostock to the list of contributors for his great work in |
Humm.. I personally worked on Looking at the source code of
|
packages/turf-concave/index.js
Outdated
existing[key] = true; | ||
} | ||
}); | ||
return featureCollection(cleaned, points.properties); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FeatureCollection doesn't have properties
as a param.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah... ok! 👍
Very happy to accept those PRs. 😁 |
Me too! 👍 haha |
+10 commits later, I think this last commit will "pass" lol 😫 |
Gday @DenisCarriere I wrote the bulk of the dissolve module so yep I remember using I'd think it's worth keeping both In regards to |
@rowanwins 👍 For sure, we can do that on a separate PR, I'm also interested in seeing how |
Yes team work 👍 🥇 |
@rowanwins @DenisCarriere |
...and |
@rowanwins what kind of differences do you have in mind? It looks to me they could be integrated in a single module that can handle a "filter/selection" parameter. |
My understanding is that traditionally the output of a This is a helpful article, by and large I think it would be good to retain consistent language with what everyone else is doing. |
👍 Thanks for the reference @rowanwins. Helpful link, got me thinking of a few new easy modules I understand a bit better now the difference between dissolve/union, the main difference with dissolve is spatial operation based on a common attribute (which it's currently doing 👍 ). |
@rowanwins so basically |
👍 |
Following #899:
@turf/union
withgeojson-dissolve
, thus removedjsts
dependency 🎊null
geometriesThe reason why I preferred
geojson-dissolve
toconcaveman
(as previously suggested) is because the latter returns always a single concave Polygon embracing all the input points, whilegeojson-dissolve
allows to return (Multi)Polygons even with holes if appropriate (as the current@turf/concave
implementation does).However, for what I've seen online after some research, I'm not sure that this is the right/expected behaviour of a
concave
module. This is mainly due to themaxEdge
parameter: if it was set toInfinity
@turf/concave
would always return a single concave hull Polygon (likeconcaveman
).In the next major release I would set
maxEdge
toInfinity
by default.Also I noticed this module throws an
Error
if there is no hull to return ("too few polygons found to compute concave hull"), likely due to a smallmaxEdge
. I would rather return an emptyFeature
.