-
Notifications
You must be signed in to change notification settings - Fork 944
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
flatten: Geometry Collection in Feature Collection does not flatten #709
Comments
Never knew that GeometryCollection inside a FeatureCollection was a thing (seems like it is), you are correct by saying nested GeometryCollection shouldn't be allowed. You might have issues using Question: Should the output remain a FeatureCollection regardless of the input geometry (open to suggestions)?
|
@dpmcmlxxvi I'm starting to get the same frustrations you're having using the |
Agreed. I think having a |
👍 Another thing I noticed with flatten is when you provide a Geometry Object it returns a FeatureCollection with Geometries (not Features). @dpmcmlxxvi Let me know if you want to tackle adding Once this is finished, |
@DenisCarriere Yeah, I'll be submitting the PR pretty soon. Agree on it hopefully simplifying the flatten code. All the crucial logic is already being done in |
While working on a PR for #692 to create a
flattenEach
method I noticed that@turf/flatten
does not appear to flatten a geometry collection that is inside a feature collection. See the jsfiddle.Not sure if this is the intended behavior. The GeoJSON spec discourages nesting geometry collections but I see nothing about nesting a geometry collection in a feature collection. So, seems like a valid use case.
I was planning on having the PR for #692 iterate over the same features that are yielded using
@turf/flatten
so I'd like some clarification on what is the desired behavior. If the current implementation is a bug than I can use a proper flattening in the PR.The fix for the current implementation seems simple enough. Have an additional check for a
GeometryCollection
type in the switch case offlattenFeatureCollection
..geojson
).The text was updated successfully, but these errors were encountered: