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

[@turf/line-slice-along] Fix offset distance equal to line length #2030

Merged
merged 2 commits into from
Feb 14, 2021

Conversation

EricPKerr
Copy link
Contributor

@EricPKerr EricPKerr commented Feb 10, 2021

@turf/line-slice-along currently returns an invalid GeoJSON LineString if you pass in an offset that is equal to the line length.

The end of the module returns:

return lineString(coords[coords.length - 1]);

Which results in:

{
  type: 'Feature',
  properties: {},
  geometry: { type: 'LineString', coordinates: [ lon, lat ] }
}

This is a Point and not a valid LineString geometry (list of coordinates). The modification here returns the last point as a valid LineString geometry.

Copy link
Collaborator

@mfedderly mfedderly left a comment

Choose a reason for hiding this comment

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

Thanks!

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