LineOffset results in 'round the world' line
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 10.5k
- Forks
- 1k
- Avg merge
- 1h 11m
- Merged PRs (30d)
- 4
Description
Has anyone else experienced this, or at least can tell me where I might be going wrong? I've reduced the problem to its simplest form here:
https://codepen.io/MarkMoir/pen/ZEEmQzv
In a nutshell, it's a line which has co-ordinates to do this:
A > B
B > C
C > B
B > D
So it's actually a vehicle journey which goes down a side road, before returning to the main road, and then onwards. I want to offset this line to an additional line which is e.g. 30m offset.
The original data is:
[ -2.9640536, 54.8791016 ],
[ -2.965021, 54.8830571 ],
[ -2.9667652, 54.8810392 ],
[ -2.965021, 54.8830571 ],
[ -2.9662238, 54.8844674 ],
[ -2.9628946, 54.8873606 ]
When I pass it through the LineOffset function, the returned geojson is broken, as you can see in the example. I think it's to do with the isParallel or similar call within the LineOffset function. The resulting in this:
[-2.9637915279707676, 54.87916569517914],
[-2.964883157834206, 54.88362914558728],
[1086983897.184041, 1257553553.4015863],
[-2.9646653815836412, 54.883055897673366],
[-2.9658450662483875, 54.88443909461608],
[-2.962717626725687, 54.88715695717377]
As you can see, the third pair of coordinates isn't great :) It results in a line going around the world, as far as I can tell. I'm guessing it's to do with some precision which is giving a number to a large number of decimal places.
Cheers for any help or comments.
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 with the linked CodePen and reproduce the failure through the LineOffset function, then inspect the isParallel call mentioned in the report. Done means the repeated A→B→C→B→D route produces finite offset coordinates without the third point sending the line around the world.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, typescript
- Domain
- data
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 32/100