Turfjs / Turfjs/turf

intersect used to work with points and lines, now only with polygons?

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

Nobody has claimed this yet.

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

Description

I don't know if an example is needed, because this bug is documented here: https://turfjs.org/docs/#intersect

"Takes two polygons and finds their intersection..." (Emphasis mine.)

Apparently TurfJS intersect used to intersect properly as other GIS analysis libraries do. To quote the following question:

"In old turfjs versions, it was possible to intersect a line and a polygon, like in this example.

But changing the turf.js version to the last one makes it fail, as shown in this other example.

The docs say that the intersect function works only with two polygons, so the error is documented.

Is it possible to use some other function to do that? Is there any example around there showing how to do it?" (Emphasis mine.)

https://gis.stackexchange.com/questions/290438/turfjs-intersect-line-and-polygon#:~:text=In%20old%20turfjs%20versions%2C%20it,polygon%2C%20like%20in%20this%20example.&text=The%20docs%20say%20that%20the,so%20the%20error%20is%20documented.

Is this ever planned to be fixed?

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 by reading the intersect documentation and comparing the old and current examples linked in the issue, then locate the intersect implementation and its existing tests. Determine whether line–polygon support is intended, and define done as either restoring that behavior with coverage or documenting the supported alternative; the issue does not name specific files or tests.

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.