Skip to content
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

Add method to divide LineString into equal chunks #183

Open
1ec5 opened this issue Mar 9, 2022 · 2 comments
Open

Add method to divide LineString into equal chunks #183

1ec5 opened this issue Mar 9, 2022 · 2 comments

Comments

@1ec5
Copy link
Contributor

1ec5 commented Mar 9, 2022

The lineChunk method should be ported to this library:

Divides a LineString into chunks of a specified length. If the line is shorter than the segment length then the original line is returned.

This method would be useful for sampling a geometry before passing the simplified geometry into a map matching algorithm: mapbox/mapbox-directions-swift#661 (comment).

Suggested LineString method signatures:

func dividedIntoChunks(of length: LocationDistance, reversed: Bool) -> MultiLineString

/cc @danpat @Guardiola31337

@1ec5 1ec5 added JS parity feature New feature request. labels Mar 9, 2022
@1ec5
Copy link
Contributor Author

1ec5 commented Mar 14, 2022

mutating func divideIntoChunks(of length: LocationDistance, reversed: Bool)

I removed this suggested method signature because it isn’t possible to convert a LineString into a MultiLineString in place. However, if we add these methods to MultiLineString itself, then it would be possible.

@MaximAlien
Copy link
Contributor

Tagging @mapbox/navigation-android for parity.

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

No branches or pull requests

3 participants