fcb_core
Read and write FlatCityBuf (.fcb)
— a cloud-optimized binary encoding of CityJSON.
It carries the standard's semantics in FlatBuffers,
with a packed Hilbert R-tree for spatial queries and static B+tree indices for
attribute queries, laid out so a client reads only the bytes it actually needs
— from a local file, a non-seekable stream, or a remote URL over HTTP range
requests. fcb_core is the reference implementation of the format and the only
one that writes it.
Install
The http feature is enabled by default and brings in reqwest and
http-range-client. For a dependency-light, purely local reader:
[]
= { = "0.7", = false }
Reading a file
use ;
use File;
use BufReader;
let file = new;
let mut features = open?.select_all?;
// The CityJSON metadata object (version, transform, CRS, extent) is the
// header; it is the first line of the equivalent CityJSONSeq document.
let cj = to_cj_metadata?;
println!;
while let Some = features.next?
Spatial queries (select_query), attribute queries (select_attr_query),
HTTP streaming (HttpFcbReader) and writing (FcbWriter) are all covered in
the crate documentation on docs.rs.
Documentation
- API reference on docs.rs
- Rust guide — workspace layout, build and test commands, worked examples
- Format specification — the byte layout, cited to source
fcb_cli— thefcbcommand-line tool for converting CityJSON to and from.fcb- Repository
Attribution
Portions of this software are derived from FlatGeobuf (BSD 2-Clause License), copyright (c) 2018-2024 Björn Harrtell and contributors — specifically the packed R-tree spatial index, the HTTP range request handling, and parts of the binary format design. See ATTRIBUTION.md for details.
License
MIT — see LICENSE. FlatGeobuf portions remain under their original BSD 2-Clause License.