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

Add ol.format.Binary #1717

Merged
merged 8 commits into from Feb 21, 2014
Merged

Add ol.format.Binary #1717

merged 8 commits into from Feb 21, 2014

Conversation

twpayne
Copy link
Contributor

@twpayne twpayne commented Feb 17, 2014

This PR adds binary support to ol.Format.

Reading binary data is done using ArrayBuffers, if available, otherwise (i.e. on IE9) it falls back to using VBArray to create an Array.<number>, where each array element is a byte. This abstraction is handled by ol.binary.Buffer.

Right now, only sequential reading of binary data, byte-by-byte, is supported, via the ol.binary.IReader interface. If/when random access is needed, appropriate methods can be added to ol.binary.Buffer.

Right now, the only binary format in progress is TWKB. See #1615 and another PR about to be opened.

@elemoine
Copy link
Member

It looks great already. I'm intereted in reviewing when this is ready.

@twpayne
Copy link
Contributor Author

twpayne commented Feb 17, 2014

This PR (just ol.format.Binary) is ready, but I'm happy to wait until #1718 is complete to provide a demonstration case.

@twpayne
Copy link
Contributor Author

twpayne commented Feb 21, 2014

Any objections to merging this? I've a load of branches that depend on this it's getting really awkward juggling them all.

@bartvde
Copy link
Member

bartvde commented Feb 21, 2014

no objections from me

@elemoine
Copy link
Member

+1

@nicklasaven
Copy link

Just a very small question.
Why not put more "readers" in this binary format. Now you have readByte, but you keep the varInt readers in the twkb format.
I mean varInt can be found in more formats than twkb that might be supported in the future like
google protobuf https://code.google.com/p/protobuf/
and
openstreetmap pbf files http://wiki.openstreetmap.org/wiki/PBF

Just a thought

@twpayne
Copy link
Contributor Author

twpayne commented Feb 21, 2014

The readers are in ol.binary. The reason for this is that different binary formats require quite different access. For example, TWKB currently requires sequential access to the binary data, whereas other formats require (and can be made much faster with) random access.

twpayne added a commit that referenced this pull request Feb 21, 2014
@twpayne twpayne merged commit 1d2c88e into openlayers:master Feb 21, 2014
@twpayne twpayne deleted the binary-format branch February 21, 2014 11:27
@nicklasaven
Copy link

Ok, Interesting!
Will you elaborate this in the twkb-feedback? I haven't seen any way to get random access without fixed size numbers like in wkb or some sort of index. Or after parsing it into some structure on client side like JSON.

But the "much faster" aspect is of course very interesting :-)

@twpayne
Copy link
Contributor Author

twpayne commented Feb 21, 2014

Yes, I'll open an issue on the TWKB repo for feedback and discussion.

@bjornharrtell bjornharrtell mentioned this pull request Jun 2, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants