Turfjs / Turfjs/turf

Isoline creation freezes browser

Open
#1,287 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Nonworking geojson data: https://gist.github.com/bakerac4/17b9807ea0bb410b2f3d63ebb61360eb
working geojson data: https://gist.github.com/bakerac4/73c0f01b201759f26e356354c1837c65

const breaks = [0, 30, 40, 50, 60, 70, 80, 90];
let isolines = turf.isolines(data, breaks , { zProperty: "value" });

This browser seems to just lock up when processing the "50" breakpoint. I know this isn't because of my data size, as I have many other data sets with the same amount of points that work.

It seems to never come out of https://github.com/Turfjs/turf/blob/master/packages/turf-isolines/lib/marchingsquares-isocontours.js#L205 tracePath. I put a logging statement in and it generates an array of > 600,000 which is why the browser locks up.

Hoping you guys can point me in the right direction, as I am lost digging around in that libraries code.

Thanks,
Adam

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

Reproduce the freeze with the nonworking GeoJSON and the breaks array from the issue, then inspect packages/turf-isolines/lib/marchingsquares-isocontours.js around tracePath at line 205. Compare the nonworking and working data while tracing the generated array; done means isoline creation completes without locking the browser for the reported input.

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
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.