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

lineIntersect does not find an intersection for two lines that share the same endpoint #2667

Open
Month7 opened this issue Aug 5, 2024 · 0 comments

Comments

@Month7
Copy link

Month7 commented Aug 5, 2024

Please provide the following when reporting an issue:

  • [turf7 ] The version of Turf you are using, and any other relevant versions.
  • [wrong.json] GeoJSON data as a gist file or geojson.io (filename extension must be .geojson).
  • [ done] Verify this issue hasn't already been reported, or resolved in the latest alpha pre-release.

my geoJson

{
  "type": "FeatureCollection",
  "features": [
    {
      "type": "Feature",
      "properties": {},
      "geometry": {
        "type": "LineString",
        "coordinates": [
          [
            116.388349,
            39.949004
          ],
          [
            116.409595,
            39.900803
          ]
        ]
      }
    },
    {
      "type": "Feature",
      "properties": {},
      "geometry": {
          "type": "LineString",
          "coordinates": [
              [
                  116.409595,
                  39.900803
              ],
              [

                  116.447661,
                  39.896049
              ]
          ]
      }
  }
  ]
}

The two lines have an approximate intersection point, but I cannot get the intersection point using lineIntersect.

image

my code

  const line1 = lineString([
    [
      116.352264,
      39.86083
    ],
    [
      116.507446,
      39.931158
    ]
  ]);
  const line2 = lineString([[
    116.507446,
    39.931158
  ],
  [
    116.525642,
    39.959058
  ]
  ]);
  console.log('res', lineIntersect(line1, line2));

@twelch twelch changed the title The intersection point cannot be obtained using lineIntersect lineIntersect does not find an intersection for two lines that share the same endpoint Aug 5, 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