LineOffset does not respect distances...
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
- Issue type
- Bug
- Clarity
- Needs clarification
- Activity status
- Stale
- Tech stack
- javascript, typescript
- Domain
- data
Research direction
Reproduce the example using turf.lineString and getLineOffset with ±4-meter units, then compare the oblique-segment coordinates with the shown buffer. Done means the returned left and right lines maintain the requested 4-meter offset for both horizontal and oblique segments, or the issue is narrowed to a documented limitation or alternative.
Written by the indexing model from the issue text.
Description
Hi,
II read several posts on the subject but I did not really find the answer.
I have a line expressed with WGS84 coordinates:
let myline = turf.lineString([4.101441, 44.279814]
,[4.101386, 44.279732]
,[4.101333, 44.279696]
,[4.10132, 44.279696]
,[4.101225, 44.279696]
,[4.101051, 44.27973]
,[4.100738, 44.279791]
,[4.100121, 44.279911]
,[4.099466, 44.280038]
,[4.099459, 44.280039]
,[4.09937, 44.280057]);
let rightline = getLineOffset(myline , 4, {units: 'meters'});
let leftline = getLineOffset(myline , -4, {units: 'meters'});
Right coordinates returned :
[4.101411124977849, 44.27983403812462]
,[4.101360013256536, 44.279757835194665]
,[4.101321938085819, 44.27973197281455]
,[4.10132, 44.27973197281455]
,[4.101228481662364, 44.27973197281455]
,[4.101057889945491, 44.279765306828196]
,[4.100744874438115, 44.2798263098504]
,[4.100127857509158, 44.2799463131429]
,[4.099471971015376, 44.280073485027955]
,[4.099465114251917, 44.280074464565594]
,[4.099377131019004, 44.280092258927304]
Left coordinates returned :
[4.101470875022152, 44.279793961875384]
,[4.1014119867434635, 44.27970616480534]
,[4.1013440619141805, 44.27966002718545]
,[4.10132, 44.27966002718545]
,[4.101221518337637, 44.27966002718545]
,[4.101044110054509, 44.279694693171805]
,[4.100731125561884, 44.27975569014961]
,[4.100114142490841, 44.279875686857096]
,[4.099460028984623, 44.28000251497204]
,[4.099452885748069, 44.28000353543441]
,[4.099362868980997, 44.280021741072694]
As you can see in the following picture, the offset seams to be ok for horizontal segments, but wrong for oblique segments. (myline in blue, buffer of 4 meters around myline in red, left and right lines in black)

is this a bug or am i forgetting something ?
What is the alternative to circumvent the problem?
Thanks for your help
- Dominant language
- TypeScript
- Stars
- 10.5k
- Forks
- 1k
- Avg merge
- 1h 11m
- Merged PRs (30d)
- 4
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.
More from Turfjs/turf
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
Difficulty 4/5 3-5 days Newbie friendliness 48/100
-
@turf/boolean-contains
Difficulty 4/5 3-5 days Newbie friendliness 45/100
-
Difficulty 4/5 3-5 days Newbie friendliness 48/100
Similar issues
-
clawsweeper:fix-shape-clear clawsweeper:queueable-fix clawsweeper:source-repro impact:ux-friction issue-rating: 🦞 diamond lobster no-stale P3
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
Difficulty 1/5 Under an hour Newbie friendliness 76/100
-
code-quality refactoring
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
github/gh-aw-firewall#8816 ·
-
integration:quickjs org:external priority:backlog topic:code-interpreter topic:middleware type:feature
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
langchain-ai/deepagents#6450 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
vercel/react-tweet#225 ·