Expand description
§Public API Overview
This page summarizes the current stable Rust-facing shape of cityjson_lib.
§Crate Root
The crate root is intentionally small:
CityModelCityJSONVersionErrorErrorKindjsonarrow(featurearrow)parquet(featureparquet)opsquery
§CityModel
CityModel is the owned semantic model type re-exported from cityjson-rs.
It is the same type whether the payload represents:
- a full document
- a feature-sized self-contained model
- a merged or extracted subset
use cityjson_lib::{json, CityModel};
let model: CityModel = json::from_file("tests/data/v2_0/minimal.city.json")?;§json
json is the default-on boundary module.
It owns:
- probing
- document parsing
- feature parsing
- feature-stream reading and writing
- document and feature serialization
- staged feature reconstruction helpers
The implementation lives in cityjson-json.
cityjson-lib keeps the public contract and error/version translation.
§arrow (feature arrow)
arrow is the optional columnar I/O boundary backed by cityjson-arrow.
Enable it with features = ["arrow"] in your Cargo.toml.
It owns:
- reading from bytes, a reader, or a file
- writing to bytes, a writer, or a file
- lower-level
read_stream/write_streamprimitives - re-exported
ExportOptions,ImportOptions,SchemaVersion,WriteReport
use cityjson_lib::{arrow, json};
let model = json::from_file("tests/data/v2_0/minimal.city.json")?;
let bytes = arrow::to_vec(&model)?;
let roundtrip = arrow::from_bytes(&bytes)?;§parquet (feature parquet)
parquet is the optional Parquet I/O boundary backed by cityjson-parquet.
Enable it with features = ["parquet"] in your Cargo.toml.
Enabling parquet also enables arrow.
It owns:
- reading and writing as a self-contained package file (
.cityjson-parquet) - reading and writing as a bare dataset directory
- re-exported
PackageManifest,ParquetDatasetManifest
use cityjson_lib::{json, parquet};
let model = json::from_file("tests/data/v2_0/minimal.city.json")?;
let dir = tempfile::tempdir()?;
let path = dir.path().join("model.cityjson-parquet");
let manifest = parquet::to_file(&path, &model)?;
assert!(!manifest.tables.is_empty());
let roundtrip = parquet::from_file(&path)?;§ops
ops exposes the workflow helpers currently shipped on the release line:
cleanupextractappendmerge
Those helpers are part of the stable facade, but their JSON-aware implementation
is delegated to cityjson-json.
§query
query exposes summary-style read helpers over CityModel without turning the
model type into a large method bag.
use cityjson_lib::{json, query};
let model = json::from_file("tests/data/v2_0/minimal.city.json")?;
let summary = query::summary(&model);
assert!(summary.cityobject_count >= 1);Re-exports§
pub use cityjson;