-
Notifications
You must be signed in to change notification settings - Fork 120
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
Adding explode turf method #1007
Conversation
c95c4c1
to
12d807c
Compare
@osana , for some reason, the test wouldn't accept my fixture for That's why I'm building those object in a different way for now:
Is there something I'm doing wrong, which is preventing me from doing Also, https://github.com/mapbox/mapbox-java/pull/1007/files#diff-b6a32aa24e73a2791a14203a75659fce is in this pr because it was invalid GeoJSON. It needed |
services-turf/src/main/java/com/mapbox/turf/TurfConversion.java
Outdated
Show resolved
Hide resolved
* @since 4.7.0 | ||
*/ | ||
private static FeatureCollection explode(@NonNull Geometry geometry) { | ||
List<Feature> featuresForFinalFeatureCollection = new ArrayList<>(); |
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.
Looks like there is a method:
https://turfjs.org/docs/#coordAll
that is supposed to work for FeatureCollection/Feature and Geometry.
We ported only the Geometry parameter.
What do you think if we port coordAll(FeatureCollection) and coordAll(Feature) and then take advantage of it here.
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.
What do you think if we port coordAll(FeatureCollection) and coordAll(Feature) and then take advantage of it here.
Yea, I think we should do this. I've needed it a bunch during my work on porting more methods to Turf for Java.
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.
Yea, I think we should do this.
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.
7a22877
to
8228322
Compare
8228322
to
eb524ca
Compare
This pr ports the explode method to Turf for Java. This method takes a
Feature
orFeatureCollection
and returns aFeatureCollection
ofPoint
objects which represent all of the positions in that originalFeature
/FeatureCollection
parameter.http://turfjs.org/docs/#explode
https://github.com/Turfjs/turf/blob/master/packages/turf-explode/index.js
explode(FeatureCollection featureCollection)
&explode(Feature feature)
are the new methods added in theTurfConversion
class.