Skip to content

Implement copyWith(options) method for the Feature class and add GeoJSON utility functions #220

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

Open
wants to merge 12 commits into
base: main
Choose a base branch
from

Conversation

Newmanjack
Copy link

Changes:
1. Utility Functions:
• featureEach: Iterates over features in any GeoJSON object (handles both single Feature and FeatureCollection).
• featureReduce: Reduces features similarly to Iterable. reduce, with special handling for absent initial values (clones the first feature when needed).
2. Feature Extension:
• Added a copyWith method via an extension on the Feature class.
• The method accepts optional parameters (id, properties, geometry, bbox) and returns a new immutable Feature with updated values.
• Includes runtime type checks for new geometry compatibility.
• Documentation and examples have been added for clear, type-safe usage.

…ling.

- Replace custom implementations with existing specialized modules
- Use turf_pip package directly for point-in-polygon checks
- Use turf_centroid, turf_midpoint, turf_area and turf_length libraries
- Make function non-nullable with proper error handling
- Update var to final in benchmark file and across codebase
- Update tests to work with geodesic midpoint calculations
- Improve documentation and code quality
This reverts changes made in commits:
- 41bfee5
- a343ee7

These coordinate conversion features will be handled in a separate PR (oWSG84_and_toMercator_unit)
@lukas-h
Copy link
Member

lukas-h commented Apr 18, 2025

@Newmanjack this PR seems to be labeled wrongly as it contains the code for point on feature, right?

@Newmanjack
Copy link
Author

@lukas-h Fixed the files, can be reviewed

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