LineOffset is crashing with two identical coordinates in sequence
Open
Nobody has claimed this yet.
@turf/line-offset
- Dominant language
- TypeScript
- Stars
- 10.5k
- Forks
- 1k
- Avg merge
- 1h 11m
- Merged PRs (30d)
- 4
Description
I'm getting the error:
catch, Error: coordinates must contain numbers
when there are two or more identical coordinates in sequence:
const arr1 = [[1,1], [1,1]]
const x = lineString(arr1)
const y = lineOffset(x, 0.001)
but this works:
const arr1 = [[1,1],[12,12], [1,1]]
const x = lineString(arr1)
const y = lineOffset(x, 0.001)
It isn't mentioned in the docs that it's not ok to have identical points...
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the issue through the lineString and lineOffset entry points with consecutive identical coordinates, then compare it with the working non-consecutive example. Done means lineOffset no longer crashes for the reported input, with behavior for duplicate points clarified or covered by a regression test.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, typescript
- Domain
- api
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100