Turfjs / Turfjs/turf

lineOverlap for two MultiLineStrings calculated incorrectly if there is some overlapping inside each MultiLineString

Open
#1,670 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

@turf/line-overlap
Dominant language
TypeScript
Stars
10.5k
Forks
1k
Avg merge
1h 11m
Merged PRs (30d)
4

Description

jsfiddle:
http://jsfiddle.net/theptyza/w76tqdey/

Two MultiLineStrings have some overlapping in their components.

var multiLine1 = turf.multiLineString(
    [[[0,0],[0,1],[0,2],[0,3],[1,3],[2,3]],
    [[1,3],[2,3],[2,2],[1,2],[0,2],[0,1],[0,0]]]
);

var multiLine2 = turf.multiLineString(
    [[[0,0],[0,1],[0,2],[0,3],[1,3],[2,3],[2,2]],
    [[2,3],[2,2],[1,2],[0,2],[0,1],[0,0]]]
);

In multiLine1 both lines share the [[1,3],[2,3]] part.
In multiLine2 both lines share the [[2,3],[2,2]] part.

These two multilines overlap completely, but overlap is displayed like this (multiLine1 in blue, multiLine2 in green, overlap in red):
image

If I remove the shared parts in multilines the overlap is displayed correctly
http://jsfiddle.net/theptyza/w76tqdey/3
image

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the lineOverlap entry point and reproduce the case from the linked JSFiddle using the two MultiLineStrings in the issue. Compare the reported overlap with the expected complete overlap, including the shared segments within each MultiLineString; done means the overlap is displayed correctly for this case.

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
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.