Turfjs / Turfjs/turf

turf.intersect to fit isobands results in incorrect output

Open
#1,908 1 comment 0 reactions 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

Good morning all,

I am using turf and Mapbox to draw isobands in a circular area by:
Using turf.interpolate to generate the grid of values,
Using turf.isobands to draw isobands on the resulted rectangular grid,
Then using turf.intersect to cut the bands to fit into the circular area {the intersect between the area and each band or between the area and each polygon in the band in case the band.geometry.coordinates.length > 1, taking into account that if the intersection is null this means the band/polygon is fully contained within the area}

The issue is that: this works well but infrequently the result contains outside the area a part from the original isobands which expected to be cut using the intersection to fit the bands totally in the area. This is an illustrative image.
Any help to generate the correct required result would be appreciated
Thank you.

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

Read the turf.interpolate, turf.isobands, and turf.intersect entry points and reproduce the circular clipping workflow described in the report. No input data or test file is supplied, so first reduce the case to a minimal reproducible example. Done means the intersected isobands contain no geometry outside the circular area and the intermittent result has regression coverage.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, typescript
Domain
data-visualization
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.