Can't encode large integer attributes
- Dominant language
- JavaScript
- Stars
- 1k
- Forks
- 86
- PR merge metrics
- No merged PRs in 30d
Description
`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]}}
]}
```
Contributor guide
Research direction
Reproduce the failure through json2geobuf using the supplied overflow input, then inspect the varint error in pbf/index.js and compare it with Tippecanoe's overflow test. Trace how large integer attributes are encoded and establish the expected handling for the listed integer and floating-point values; done means the input no longer exits with the 10-byte varint error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- data
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100