Skip to content

[editable-layers] Update to turf 7 and use geojson types #221

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

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

timnyborg
Copy link

@timnyborg timnyborg commented Feb 28, 2025

This is an attempt at updating editable-layers to rely on turf.js@7 to remove the type carnage that came from competing geojson, turf.js, and nebula.gl type definitions.

  • Mostly changes to replace the custom nebula Feature and FeatureCollection types with geojson's, narrowing to exclude GeometryCollection (which is unsupported)
  • Updates a few calls where turf.js functions now require FeatureCollection inputs (intersect, difference, etc.) or return a Feature (centroid)
  • Updates a couple values in tests, due to an upstream fix in @turf/area
  • Drops a lot of unneeded ts-expect-errors. Leaves a few type assertions in place to avoid additional functional changes, but the type safety is much improved
  • Updates "mode handlers", even though they seem to be long dead. Should they just be dropped from the package?
  • Drops code from long, long dead lib folder, and an unused curve-utils file, rather than trying to update turf usages there.

Assuming the PR is otherwise acceptable, I'm unsure what other work might need to be done. Other modules in the repo specify turf 6.5, so we might want to update them as well (examples, examples-wip, react, website)

Addresses #202

@timnyborg timnyborg changed the title Turf 7 and geojson [editable-layers] Update to turf 7 and use geojson types Feb 28, 2025

export type Polygonal = Polygon | MultiPolygon;

// Feature types

export type BoundingBoxArray = [number, number, number, number];
import { Feature, FeatureCollection } from 'geojson';
export { Feature, FeatureCollection } from 'geojson';
Copy link
Author

Choose a reason for hiding this comment

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

Probably want to drop this export, and have all files import directly from geojson instead - this was a quick way to make the switch.

@charlieforward9
Copy link

@timnyborg id like to see this land before integrating the editable-layers into my repo. What additional work is required here?

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.

None yet

2 participants