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

Max call stack size error on a certain input #104

Closed
mourner opened this issue Jun 12, 2018 · 4 comments
Closed

Max call stack size error on a certain input #104

mourner opened this issue Jun 12, 2018 · 4 comments
Labels

Comments

@mourner
Copy link
Member

mourner commented Jun 12, 2018

Originally reported at mapbox/mapbox-gl-js#6086 (comment)

Minimal test case for Node v8:

const geojsonvt = require('geojson-vt');

const coords = [];
for (let i = 0; i < 1400; i++) {
    coords.push([0.0, 0.0], [1.0, 0.0], [1.0, 1.0], [0.0, 1.0]);
}

const data = {
    "type": "LineString",
    "coordinates": coords
};

geojsonvt(data);

cc @JamesChevalier

@JamesChevalier
Copy link

JamesChevalier commented Jun 12, 2018

Let me know if you would like any real world testing. I'm happy to throw around beta software to see if https://citystrides.com/users/5560/map loads properly with the latest Mapbox GL JS in Safari or Chrome on a Mac (where I originally noticed the issue).

mourner added a commit that referenced this issue Jun 15, 2018
* eliminate recursion in simplify routine

Closes #104.

* optimzie non-recursive simplification

* alternative fix for denerate simplify

* improve degenerate input fix

* better comment explaining the fix
@district10
Copy link
Contributor

Why mid is (last-first)/2? Shouldn't it be (first+last)/2?

(or first + (last-first)>>1 for avoiding overflow.)

Related code:

@mourner
Copy link
Member Author

mourner commented Jul 28, 2023

@district10 nice catch, likely a mistake (although it shouldn't affect correctness of the output at least). Want to PR a fix?

@district10
Copy link
Contributor

@mourner Sure. Two PRs created.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants