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

lineOverlap does not recognize partially overlaps #2580

Open
jsiedentop opened this issue Feb 24, 2024 · 1 comment
Open

lineOverlap does not recognize partially overlaps #2580

jsiedentop opened this issue Feb 24, 2024 · 1 comment

Comments

@jsiedentop
Copy link

The lineOverlap function currently does not recognize when two lines partially overlap. This also affects booleanOverlap.

You can see it in this example:
The blue and red lines clearly overlap in the green area. However, this is not recognized because the implementation can currently only recognize an overlap if a segment is completely overlapping.

image
{
  "type": "FeatureCollection",
  "features": [
    {
      "type": "Feature",
      "properties": {
        "stroke": "#0F0",
        "fill": "#0F0",
        "stroke-width": 25
      },
      "geometry": {
        "type": "LineString",
        "coordinates": [
          [120, -25],
          [150, -25]
        ]
      }
    },
    {
      "type": "Feature",
      "properties": {
        "stroke": "#F00",
        "fill": "#F00",
        "stroke-width": 10,
        "stroke-opacity": 1,
        "fill-opacity": 0.1
      },
      "geometry": {
        "type": "LineString",
        "coordinates": [
          [120, -25],
          [160, -25]
        ]
      }
    },
    {
      "type": "Feature",
      "properties": {
        "stroke": "#00F",
        "fill": "#00F",
        "stroke-width": 3,
        "stroke-opacity": 1,
        "fill-opacity": 0.1
      },
      "geometry": {
        "type": "LineString",
        "coordinates": [
          [110, -25],
          [150, -25]
        ]
      }
    }
  ]
}
@jsiedentop
Copy link
Author

This issue could possibly be solved with #2349. By the way, I noticed it because the test case from #901 is passing only due to the generous tolerance and it is actually a false positive.

@smallsaucepan smallsaucepan changed the title @turf/turf-line-overlap lineOverlap does not recognize partially overlaps. lineOverlap does not recognize partially overlaps Mar 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants