cityjson-convert 0.1.0

CityJSON format converter
Documentation

cityjson-convert

cityjson-convert converts CityJSON data to other formats.

At the moment it supports glTF output, both through the library API and through the cjconvert CLI. More output formats may be added in future releases.

Library

Use the library when you want to convert a parsed CityModel to a GLB file:

use cityjson_convert::{convert_to_glb, ExportOptions, GeometryPlacement};
use cityjson_lib::CityModel;

fn export(model: &CityModel) -> anyhow::Result<()> {
    let options = ExportOptions {
        native_glb_color: "#FFC0CB".to_string(),
        metadata_class_name: "cityobject".to_string(),
        feature_type_colors: Default::default(),
        geometry_placement: GeometryPlacement::SourceCoordinates,
        clip_bbox: None,
        clip_geographic_region: None,
        smooth_normals: false,
        quantize_geometry: true,
        meshopt_compression: true,
    };

    convert_to_glb(model, "output/tiles.glb", &options)
}

CLI

Convert a CityJSON file to a GLB file from the command line:

cjconvert input.city.json --output output/model.glb

You can also customize the output:

cjconvert input.city.json \
  --output output/model.glb \
  --native-glb-color "#FFC0CB" \
  --3dtiles-metadata-class cityobject \
  --smooth-normals