Expand description
cjseq2 is a typed fork of cjseq,
for reading, writing, and converting between CityJSON and CityJSONSeq.
The library crate is still named cjseq (see Cargo.toml’s [lib]
section), so existing code that does use cjseq::CityJSON keeps working
unchanged. The package itself is published as cjseq2 pending an
eventual merge upstream.
Internally the crate is organised into one module per concern:
geometry—Geometry,GeometryType,GeometryTemplatessemantics—Semantics,SemanticsSurface,SemanticsValuesappearance—Appearance,MaterialReference,MaterialValues,TextureReference,TextureValuescity_object—CityObjectmetadata—Metadata,PointOfContact,Address,ReferenceSystem,Transform,GeographicalExtenterror—CjseqError,Resultcityjson—CityJSON,CityJSONFeature,SortingStrategy, and the sequencing/collect/filter logic
Every type is re-exported at the crate root, so the module boundaries
above are an internal organisational detail, not part of the public
import paths. The one exception is the Result<T> alias, which stays at
error::Result so that a glob use cjseq::* cannot shadow
std::result::Result.
Re-exports§
pub use error::CjseqError;
Modules§
Structs§
- Address
- The
addressmember of aPointOfContact(§ 5.3 pointOfContact). - Appearance
- The document-level appearance library.
- CityJSON
- CityJSON
Feature - City
Object - Geometry
Common - The members every geometry may carry that are neither its type, its lod, nor its boundaries. The appearance values are depth-typed, keyed by theme.
- Geometry
Templates - Material
Object - One entry of the document-level
appearance.materialspalette, referred to by index from aMaterialReference. - Material
Reference - One theme’s material assignment for a geometry: either a
valuecolouring the whole object, or a depth-typedvaluesarray with one index per surface. - Metadata
- The
metadatamember of acrate::CityJSONobject (§ 5 Metadata). - Point
OfContact - The
pointOfContactmember ofMetadata(§ 5.3). - Reference
System - A reference system following the OGC Name Type Specification.
- Semantics
- The
semanticsmember of a geometry. - Semantics
Surface - One semantic surface: its type, its place in the parent/children hierarchy, and any further attributes the file chooses to carry.
- Texture
Object - One entry of the document-level
appearance.texturespalette, referred to by the first entry of each ring in aTextureValues. - Texture
Reference - One theme’s texture assignment for a geometry.
- Transform
Enums§
- Border
Color - A texture’s
borderColor, whose schema is the one place a CityJSON colour is not fixed at three numbers: - CityJSON
Feature Type - The
typemember of aCityJSONFeatureobject. The spec fixes its value to the single string"CityJSONFeature"(§ 7.2 Text sequences and streaming with CityJSONFeature); as withCityJSONType, there is no Extension variant. - CityJSON
Type - The
typemember of aCityJSONobject. The spec fixes its value to the single string"CityJSON"(§ 1 CityJSON Object); unlike City Object and semantic-surface types, CityJSON does not define an Extension document type, so there is noExtensionvariant here – a document declaring any othertypevalue fails to deserialize. - City
Object Type - The
typemember of a City Object (§ 2 The different City Objects). - Geometry
- A CityJSON geometry object.
- Geometry
Type - The tag of a
Geometry, for callers that need the kind without matching on the whole enum. - Known
City Object Type - The known 1st- and 2nd-level City Object types (§ 2 The different City
Objects). Every variant is a unit variant and every identifier is already
spelled exactly as the spec requires (eg
TINRelief,WaterBody,CityFurniture), so serde’s default (non-untagged) derive collapses each one to its bare name string with no#[serde(rename)]needed. - Known
Semantic Surface Type - The known surface types the spec assigns to Building-, WaterBody-, and
Transportation-family City Objects (§ 3.3 Semantics of geometric
primitives). Every variant is a unit variant already spelled exactly as
the spec requires, so serde’s default (non-untagged) derive collapses
each one to its bare name string with no
#[serde(rename)]needed. - Material
Values - The
valuesarray of aMaterialReference: one index into the document’smaterialspalette per surface, so it is nested exactly two levels less deeply than that geometry’sboundaries(CityJSON 2.0, section 6.1). - Semantic
Surface Type - The
typemember of a Semantic Object (§ 3.3 Semantics of geometric primitives). - Semantics
Values - The
valuesarray of aSemanticsobject: one index intosurfacesper surface of the geometry, so it is nested exactly one level less deeply than that geometry’sboundaries. - Sorting
Strategy - Texture
Format - A texture image’s file format:
"type": {"enum": ["PNG", "JPG"]}. - Texture
Type - What a texture depicts:
"textureType": {"enum": ["unknown", "specific", "typical"]}. Lower case, and a closed set. - Texture
Values - The
valuesarray of aTextureReference: nested exactly as deeply as the geometry’sboundaries(CityJSON 2.0, section 6.2), with each ring becoming[texture_index, uv_index, ...]— one more entry than the ring has vertices. An untextured ring is[null]. - Wrap
Mode - How a texture repeats outside
[0, 1]:"wrapMode": {"enum": ["none", "wrap", "mirror", "clamp", "border"]}.
Functions§
- cjseq_
to_ cj - Collects a base CityJSON metadata and a vector of CityJSONFeatures into a complete CityJSON object
Type Aliases§
- Color
- A material or border colour: three numbers, per
appearance.schema.json’s"minItems": 3, "maxItems": 3ondiffuseColor,emissiveColorandspecularColor. - Geographical
Extent - Material
Shell - One shell’s worth of material indices, one per surface.
None— a whole shell with no material — isnullin JSON, whichgeomprimitives.schema.jsonpermits at every level ofmaterial.values("type": ["array", "null"]). - Material
Solid - One solid’s worth of material indices, one per surface, per shell.
- Ring
- A closed sequence of vertex indices bounding a face.
- Semantics
Shell - One shell’s worth of semantic-surface indices, one per surface.
None— a whole shell with no semantics — isnullin JSON, whichgeomprimitives.schema.jsonpermits at every level ofsemantics.values("type": ["array", "null"]), exactly as it does formaterial.values. - Semantics
Solid - One solid’s worth of semantic-surface indices, per surface, per shell.
- Shell
- A closed collection of surfaces bounding a volume.
- Surface
- A face: the exterior ring first, then any interior rings.
- Textured
Ring - One ring’s texture entry: the texture index first, then one UV-vertex
index per vertex of the ring — so one entry more than the ring has
vertices.
[null]means the ring is not textured. - Textured
Shell - One volume’s bounding faces, mirroring
crate::Shell. - Textured
Surface - One face’s rings, exterior first, mirroring
crate::Surface.