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

Can't encode large integer attributes #87

Open
e-n-f opened this issue Nov 9, 2017 · 2 comments
Open

Can't encode large integer attributes #87

e-n-f opened this issue Nov 9, 2017 · 2 comments
Labels

Comments

@e-n-f
Copy link

e-n-f commented Nov 9, 2017

json2geobuf exits with this error:

/usr/local/lib/node_modules/geobuf/node_modules/pbf/index.js:429
        throw new Error('Given varint doesn\'t fit into 10 bytes');

when given this input (the overflow test from Tippecanoe):

{"type":"FeatureCollection","features":[
{"type":"Feature","properties":{"excess":2222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222},"geometry":{"type":"Point","coordinates":[0,0]}}
,
{"type":"Feature","properties":{"excess":22e291},"geometry":{"type":"Point","coordinates":[0,0]}}
,
{"type":"Feature","properties":{"excess":2.5},"geometry":{"type":"Point","coordinates":[0,0]}}
,
{"type":"Feature","properties":{"excess":2147483648},"geometry":{"type":"Point","coordinates":[0,0]}}
,
{"type":"Feature","properties":{"excess":-2147483648},"geometry":{"type":"Point","coordinates":[0,0]}}
,
{"type":"Feature","properties":{"excess":2147483647},"geometry":{"type":"Point","coordinates":[0,0]}}
,
{"type":"Feature","properties":{"excess":-2147483647},"geometry":{"type":"Point","coordinates":[0,0]}}
,
{"type":"Feature","properties":{"excess":18446744073709551616},"geometry":{"type":"Point","coordinates":[0,0]}}
,
{"type":"Feature","properties":{"excess":-18446744073709551616},"geometry":{"type":"Point","coordinates":[0,0]}}
,
{"type":"Feature","properties":{"excess":18446744073709551615},"geometry":{"type":"Point","coordinates":[0,0]}}
,
{"type":"Feature","properties":{"excess":-18446744073709551615},"geometry":{"type":"Point","coordinates":[0,0]}}
,
{"type":"Feature","properties":{"excess":9223372036854775808},"geometry":{"type":"Point","coordinates":[0,0]}}
,
{"type":"Feature","properties":{"excess":-9223372036854775808},"geometry":{"type":"Point","coordinates":[0,0]}}
,
{"type":"Feature","properties":{"excess":9223372036854775807},"geometry":{"type":"Point","coordinates":[0,0]}}
,
{"type":"Feature","properties":{"excess":-9223372036854775807},"geometry":{"type":"Point","coordinates":[0,0]}}
]}
@mourner
Copy link
Member

mourner commented Nov 29, 2017

Is geobuf expected to support numbers like this? It's at least 3 orders of magnitude bigger than Number.MAX_SAFE_INTEGER.

@e-n-f
Copy link
Author

e-n-f commented Nov 29, 2017

I don't know. It works with the vector tile format, which supports 64-bit signed and unsigned integers, which is what I was trying to test here, but isn't going to be comfortable for anything like JavaScript that wants everything to be doubles. I would have expected it to get rounded to the nearest double instead of giving an error.

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

2 participants