Skip to content

Comments

Additional ergonomic constructors (for Geometry and FeatureCollection)#271

Open
michaelkirk wants to merge 3 commits intomkirk/remove-json-methodsfrom
mkirk/ergonomic-geometry
Open

Additional ergonomic constructors (for Geometry and FeatureCollection)#271
michaelkirk wants to merge 3 commits intomkirk/remove-json-methodsfrom
mkirk/ergonomic-geometry

Conversation

@michaelkirk
Copy link
Member

@michaelkirk michaelkirk commented Jan 31, 2026

  • I agree to follow the project's code of conduct.
  • I added an entry to CHANGES.md if knowledge of this change could be valuable to users.

Based on #270, so please review that first. If we decide not to merge #270, I can rebase this.

Like #265, but for Geometry, not GeometryValue, and added a FeatureCollection::new(features) which I expect will be more discoverable than features.into_iter().collect::<FeatureCollection>().

I also touched up the docs a bit.

This is a bit of a junk drawer polishing pull request. I could open a PR for each commit, but I think they're all pretty simple.

We have a lot of places where we build a GeometryValue and then convert
it to a Geometry. Building the Geometry directly is a little cleaner.
I think it'll be easier for people to find
FeatureCollection::new(features) rather than
features.into_iter().collect();
@michaelkirk michaelkirk mentioned this pull request Feb 18, 2026
}

impl FeatureCollection {
/// Construct a `FeatureCollection` from an iterator of Features (or things that can be turned `Into` a Feature)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a very convenient new API :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants