Comments (4)
I assume you create the BigInt by invoking it using the string id? For example: BigInt(id)
If this is the case I'm not sure if adding this behavior as a feature flag to osm-read is worth the effort. People which need the id in a number representation can easily do by themself.
Are there any more benefits of parsing the id within osm-read which I have missed @metabench ?
from osm-read.
The earlier it's represented as BigInt the less time strings longer that 8 bytes need to be stored. It's not a big efficiency difference.
Getting the data from osm-read in the most appropriate type is the largest advantage as far as I can tell. Would make programming it easier and maybe a bit more performant.
from osm-read.
There would likely be less processing to do between the data that's stored in the protobuf and having usable output if it were parsed as BigInt. I don't know whether or not there is anything in the osm-read codebase that would make it difficult to do, such as relying on a schema or dependency which already parses them into strings.
from osm-read.
Looking at various TODOs such as
Line 335 in 411aba2
There is no problem with integers of the size we get in OSM PBF files, such as for high node IDs. File positions beyond 2^32 are also fine.
"The Number.MAX_SAFE_INTEGER constant represents the maximum safe integer in JavaScript (253 – 1)." - MDN Web Docs.
It's worth noting that the numeric parts beyond 32bit are lost when doing binary operations such as '>>>'.
When representing these numbers in a TypedArray, 64 bit integer types should be used (signed or unsigned will work, but I go for unsigned when I am only supporting unsigned numbers).
from osm-read.
Related Issues (20)
- lat lon are not in WSG84 format HOT 5
- Relations HOT 2
- Relation members output format HOT 6
- number instead of string for id, uid and ref? HOT 3
- Pause/Resume HOT 12
- Parser getting stuck HOT 1
- Cannot read property 'byteLength' of undefined HOT 5
- Example pbf.html is Broken HOT 6
- Too Much Recursion HOT 4
- Get tag "center" from overpass-api response xml HOT 2
- Invalid typed array length in arrayBufferReader Line 12 HOT 1
- Allocation failed - process out of memory HOT 1
- Tags unresolved HOT 3
- Vulnerability in protobuf dependencies HOT 2
- pbfParser in node.js and "TypeError: Invalid non-string/buffer chunk" HOT 9
- Is it possible to do any progress indication HOT 1
- Module not found: Error: Can't resolve '../../node_modules/zlibjs/bin/inflate.min.js' HOT 1
- Would exposing an async iterator API suit this library? HOT 3
- primitivegroup.length - Is it always 1? HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from osm-read.