mapbox / geobuf

A compact binary encoding for geographic data.
ISC License
967 stars 84 forks source link

Question: Why the encode and decode logic? #116

Closed 4F2E4A2E closed 3 years ago

4F2E4A2E commented 3 years ago

Hi there,

thank you so much for this repo and great work. I am new to this topic and think I did not understand something essentially here.

Is there no way to design a proto message which will represent a geojson completely and let protoc create the pb files with the generated encode and decode functions?

Why do we need the custom logic in the encode and decode js files? What are the limitations I am not getting here?

Any help is much apreciatet. Thank you.

4F2E4A2E commented 3 years ago

@mourner can you help out?

mourner commented 3 years ago

We need custom encoding and decoding logic to apply GeoJSON-specific compression algorithms such as delta-encoding coordinates and deduplicating property keys & values, allowing for much compact files. If you were to encode GeoJSON files as is into Protocol Buffers, you would get much bigger file sizes.