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

Exceeded Call Stack #7

Open
dp1140a opened this issue Feb 18, 2020 · 4 comments
Open

Exceeded Call Stack #7

dp1140a opened this issue Feb 18, 2020 · 4 comments
Labels

Comments

@dp1140a
Copy link

dp1140a commented Feb 18, 2020

773k world.svg

When running i get the following:

svg2geojson --layers -m world.svg
Ignoring unhandled element text
Ignoring unhandled element text
Ignoring unhandled element text
Ignoring unhandled element text
Ignoring unhandled element text
Ignoring unhandled element text
Ignoring unhandled element text
Ignoring unhandled element text
Ignoring unhandled element text
Ignoring unhandled element text
Ignoring unhandled element text
Ignoring unhandled element text
Ignoring unhandled element text
Ignoring unhandled element text
Ignoring unhandled element text
Ignoring unhandled element text
events.js:187
throw er; // Unhandled 'error' event
^

RangeError: Maximum call stack size exceeded
at sampleCubicBézier (/usr/local/lib/node_modules/svg2geojson/node_modules/svg-path-to-polygons/svg-path-to-polygons.js:55:28)
at sampleCubicBézier (/usr/local/lib/node_modules/svg2geojson/node_modules/svg-path-to-polygons/svg-path-to-polygons.js:79:5)
at sampleCubicBézier (/usr/local/lib/node_modules/svg2geojson/node_modules/svg-path-to-polygons/svg-path-to-polygons.js:79:5)
at sampleCubicBézier (/usr/local/lib/node_modules/svg2geojson/node_modules/svg-path-to-polygons/svg-path-to-polygons.js:79:5)
at sampleCubicBézier (/usr/local/lib/node_modules/svg2geojson/node_modules/svg-path-to-polygons/svg-path-to-polygons.js:79:5)
at sampleCubicBézier (/usr/local/lib/node_modules/svg2geojson/node_modules/svg-path-to-polygons/svg-path-to-polygons.js:79:5)
at sampleCubicBézier (/usr/local/lib/node_modules/svg2geojson/node_modules/svg-path-to-polygons/svg-path-to-polygons.js:79:5)
at sampleCubicBézier (/usr/local/lib/node_modules/svg2geojson/node_modules/svg-path-to-polygons/svg-path-to-polygons.js:79:5)
at sampleCubicBézier (/usr/local/lib/node_modules/svg2geojson/node_modules/svg-path-to-polygons/svg-path-to-polygons.js:79:5)
at sampleCubicBézier (/usr/local/lib/node_modules/svg2geojson/node_modules/svg-path-to-polygons/svg-path-to-polygons.js:79:5)
Emitted 'error' event on Parser instance at:
at Parser.exports.Parser.Parser.parseString (/usr/local/lib/node_modules/svg2geojson/node_modules/xml2js/lib/parser.js:327:16)
at Parser.parseString (/usr/local/lib/node_modules/svg2geojson/node_modules/xml2js/lib/parser.js:5:59)
at loadFromString (/usr/local/lib/node_modules/svg2geojson/lib/svg2geojson.js:21:3)
at loadFromFile (/usr/local/lib/node_modules/svg2geojson/lib/svg2geojson.js:15:2)
at Object. (/usr/local/lib/node_modules/svg2geojson/bin/svg2geojson:41:1)

@Phrogz Phrogz transferred this issue from Phrogz/svg2geojson Mar 27, 2020
@Phrogz
Copy link
Owner

Phrogz commented Mar 27, 2020

Thanks for the report. Looks like adaptive subsampling algorithm I reused uses recursion and for some reason dove too deep on a particular path. The tolerance might need to be adjusted, but it's currently calculated by the library.

If you have the time, I'd appreciate it if you can either share the SVG that caused this issue, or (if its proprietary) pare it down to find the path in question causing the issue.

@Phrogz Phrogz added the bug label Mar 27, 2020
@AlexsandroProjetosOficial
Copy link

AlexsandroProjetosOficial commented May 5, 2020

@Phrogz

When executing a svg the following error appears below, how can I fix it:

(node:9140) UnhandledPromiseRejectionWarning: RangeError: Maximum call stack size exceeded
at sampleCubicBézier (F:\SystemRedeAll\APIs\api_biblioteca\node_modules\svg-path-to-polygons\svg-path-to-polygons.js:55:28)
at sampleCubicBézier (F:\SystemRedeAll\APIs\api_biblioteca\node_modules\svg-path-to-polygons\svg-path-to-polygons.js:79:5)
at sampleCubicBézier (F:\SystemRedeAll\APIs\api_biblioteca\node_modules\svg-path-to-polygons\svg-path-to-polygons.js:79:5)
at sampleCubicBézier (F:\SystemRedeAll\APIs\api_biblioteca\node_modules\svg-path-to-polygons\svg-path-to-polygons.js:79:5)
at sampleCubicBézier (F:\SystemRedeAll\APIs\api_biblioteca\node_modules\svg-path-to-polygons\svg-path-to-polygons.js:79:5)
at sampleCubicBézier (F:\SystemRedeAll\APIs\api_biblioteca\node_modules\svg-path-to-polygons\svg-path-to-polygons.js:79:5)
at sampleCubicBézier (F:\SystemRedeAll\APIs\api_biblioteca\node_modules\svg-path-to-polygons\svg-path-to-polygons.js:79:5)
at sampleCubicBézier (F:\SystemRedeAll\APIs\api_biblioteca\node_modules\svg-path-to-polygons\svg-path-to-polygons.js:79:5)
at sampleCubicBézier (F:\SystemRedeAll\APIs\api_biblioteca\node_modules\svg-path-to-polygons\svg-path-to-polygons.js:79:5)
at sampleCubicBézier (F:\SystemRedeAll\APIs\api_biblioteca\node_modules\svg-path-to-polygons\svg-path-to-polygons.js:79:5)
at sampleCubicBézier (F:\SystemRedeAll\APIs\api_biblioteca\node_modules\svg-path-to-polygons\svg-path-to-polygons.js:79:5)
at sampleCubicBézier (F:\SystemRedeAll\APIs\api_biblioteca\node_modules\svg-path-to-polygons\svg-path-to-polygons.js:79:5)
at sampleCubicBézier (F:\SystemRedeAll\APIs\api_biblioteca\node_modules\svg-path-to-polygons\svg-path-to-polygons.js:79:5)
at sampleCubicBézier (F:\SystemRedeAll\APIs\api_biblioteca\node_modules\svg-path-to-polygons\svg-path-to-polygons.js:79:5)
at sampleCubicBézier (F:\SystemRedeAll\APIs\api_biblioteca\node_modules\svg-path-to-polygons\svg-path-to-polygons.js:79:5)
at sampleCubicBézier (F:\SystemRedeAll\APIs\api_biblioteca\node_modules\svg-path-to-polygons\svg-path-to-polygons.js:79:5)
(node:9140) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was
not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 4)

svg:

<style type="text/css"> .st0{fill:none;stroke:#000000;stroke-width:0.8504;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;} </style> [svg.txt](https://github.com/Phrogz/svg-path-to-polygons/files/4582163/svg.txt)

@richardstefun
Copy link

If you have the time, I'd appreciate it if you can either share the SVG that caused this issue, or (if its proprietary) pare it down to find the path in question causing the issue.

Hello, I was able to detect the path that causes this issue:

M120.5,350.2c0-0.7,0.1-1.6,0.1-1.6c0-0.6,0.1-1,0.1-1.3c-0.3,0.3-0.6,0.6-1,0.9c-5.9,4.8-17.9,6-24.1-0.8 c-3.7-4.1-5.7-11.4-2.3-16.4c1.8-2.6,5-4.5,8.4-4.7c1.1,0,4.9-0.2,7.2,2.7c1.4,1.8,2,4.4,1.2,6.7c-0.2,0.6-0.9,2.8-3.1,3.9 c-2.1,0.9-4.9,0.6-6.4-1.2c-1.5-1.8-1.3-4.3-1.2-4.4c0,0,0,0,0,0c0-0.2-0.8-0.3-1.1-0.2c-0.8,0.2-1.3,2.5-1,4.2 c0.5,3.1,3.5,5.3,6,6.3c5.7,2.2,11.3-1.5,12.5-2.2c5.3-3.4,7-8.8,7.4-10.5c0.4,0.4,0.8,0.8,1.2,1.2c1.5,1.3,3,2.2,4.3,2.8 c-0.1,0.4-0.2,0.9-0.3,1.6c-1.2,7.2-1.7,20.6,3.8,23.1c1.9,0.9,4.8,0.4,4.9-0.2c0.1-0.6-0.2-0.8-0.2-0.8l-1.3-1.1 c-0.9-0.8-1-2.5-0.7-3.8c0.6-2.1,2.6-3,2.9-3.1c2.6-1.1,4.9,0.5,5.1,0.6c2.1,1.4,2.4,4,2.5,5.5c0.3,2.9-1.3,7.9-4.7,9.7 c-7.1,3.8-13.7-0.5-17.3-6.2C121,357.2,120.4,354,120.5,350.2z

I hope it can help you find the issue :)

@Crisfole
Copy link

Crisfole commented Oct 1, 2021

@Phrogz for us this is usually curves where the start and end points are the same.

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

5 participants