cityjson-arrow 0.6.1

Arrow IPC and Parquet transport for CityJSON 2.0 city models
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
# Package schema

This document specifies the canonical table contract shared by `cityjson-arrow` streams
and `cityjson-parquet` packages.

## Terminology

The key words MUST, MUST NOT, REQUIRED, SHOULD, and OPTIONAL in this document are to be
interpreted as described in [RFC 2119](https://www.rfc-editor.org/rfc/rfc2119).

## Version

| Field | Value |
|---|---|
| Schema id | `cityjson-arrow.package.v3alpha3` |
| Data model | `cityjson::v2_0::OwnedCityModel` |

## Canonical tables

The schema defines 24 canonical tables. Each table has a fixed integer tag used in
the live stream and a string name used in the persistent package manifest. Tables
MUST appear in tag order. A conforming producer MUST include all REQUIRED tables and
MUST NOT include any table more than once.

Tag 1 is reserved for the removed `transform` table and MUST be rejected by
`v3alpha3` readers. Coordinates are stored as materialized real-world coordinates;
CityJSON quantization metadata is not part of this transport schema.

| Tag | Name | Required | Description |
|-----|------|----------|-------------|
| 0 | `metadata` | REQUIRED | CityJSON metadata: model name, geographic extent, and spatial reference |
| 2 | `extensions` | OPTIONAL | CityJSON extension declarations referenced by city objects in this model |
| 3 | `vertices` | REQUIRED | Shared 3D vertex coordinates for all city object geometries |
| 4 | `template_vertices` | OPTIONAL | Vertex coordinates used by geometry templates |
| 5 | `texture_vertices` | OPTIONAL | UV coordinates for texture mapping |
| 6 | `semantics` | OPTIONAL | Semantic surface type definitions |
| 7 | `semantic_children` | OPTIONAL | Parent-child relationships between semantic surfaces |
| 8 | `materials` | OPTIONAL | Material definitions |
| 9 | `textures` | OPTIONAL | Texture definitions |
| 10 | `template_geometry_boundaries` | OPTIONAL | Boundary indices for geometry template surfaces |
| 11 | `template_geometry_semantics` | OPTIONAL | Semantic surface assignments for geometry templates |
| 12 | `template_geometry_materials` | OPTIONAL | Material assignments for geometry template surfaces |
| 13 | `template_geometry_ring_textures` | OPTIONAL | Texture UV assignments for geometry template rings |
| 14 | `template_geometries` | OPTIONAL | Geometry template definitions; instances reference these by ordinal |
| 15 | `geometry_boundaries` | REQUIRED | Boundary indices for city object geometry surfaces |
| 16 | `geometry_surface_semantics` | OPTIONAL | Semantic surface assignments for surface geometries |
| 17 | `geometry_point_semantics` | OPTIONAL | Semantic point assignments for point geometries |
| 18 | `geometry_linestring_semantics` | OPTIONAL | Semantic line assignments for line string geometries |
| 19 | `geometry_surface_materials` | OPTIONAL | Material assignments for geometry surfaces |
| 20 | `geometry_ring_textures` | OPTIONAL | Texture UV assignments for geometry rings |
| 21 | `geometry_instances` | OPTIONAL | Geometry instance records: template ordinal and placement transform |
| 22 | `geometries` | REQUIRED | Geometry definitions (type, LoD) linking city objects to boundary or instance tables |
| 23 | `cityobjects` | REQUIRED | City object records: identifier, type, and typed attributes |
| 24 | `cityobject_children` | OPTIONAL | Parent-child relationships between city objects |

## Header

Both live streams and persistent packages carry a `CityArrowHeader` object that
identifies the format version and the source model.

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `package_version` | string | REQUIRED | Always `"cityjson-arrow.package.v3alpha3"` |
| `citymodel_id` | string | REQUIRED | Identifier for the source city model |
| `cityjson_version` | string | REQUIRED | CityJSON version of the source data, e.g. `"2.0"` |

## Projection layout

Both live streams and persistent packages carry a `ProjectionLayout` object. It records
the typed attribute column layout discovered from the model at export time. The decoder
uses it to validate column schemas and reconstruct nested dynamic attributes.

In the live stream, `ProjectionLayout` is embedded in the prelude JSON. In the persistent
package, it is embedded in the manifest JSON. A producer MUST include `ProjectionLayout`
in the prelude or manifest even when the model has no dynamic attributes; in that case
the value is an empty object (`{}`).

## Live stream prelude

The stream prelude is a UTF-8 JSON object. It MUST contain:

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `header` | object | REQUIRED | A `CityArrowHeader` object |
| `projection` | object | REQUIRED | A `ProjectionLayout` object |

Minimal example:

```json
{
  "header": {
    "package_version": "cityjson-arrow.package.v3alpha3",
    "citymodel_id": "NL.IMBAG.Pand",
    "cityjson_version": "2.0"
  },
  "projection": {}
}
```

## Persistent manifest

The package manifest is a UTF-8 JSON object appended to the file after all table payloads.
It MUST contain:

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `package_schema` | string | REQUIRED | Always `"cityjson-arrow.package.v3alpha3"` |
| `cityjson_version` | string | REQUIRED | CityJSON version of the source data |
| `citymodel_id` | string | REQUIRED | Identifier for the source city model |
| `projection` | object | REQUIRED | A `ProjectionLayout` object |
| `tables` | array | REQUIRED | Ordered list of table entries; see below |

Each entry in `tables` MUST contain:

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `name` | string | REQUIRED | Canonical table name |
| `offset` | uint64 | REQUIRED | Byte offset of the table payload from the start of the file |
| `length` | uint64 | REQUIRED | Byte length of the table payload |
| `rows` | uint64 | REQUIRED | Declared row count of the table payload |

A reader MUST reject a manifest whose `tables` array is not in canonical tag order.
A reader MUST reject a manifest that lists the same table name more than once.
A reader MUST reject a manifest that omits any REQUIRED table.

Minimal example (five required tables only):

```json
{
  "package_schema": "cityjson-arrow.package.v3alpha3",
  "cityjson_version": "2.0",
  "citymodel_id": "NL.IMBAG.Pand",
  "projection": {},
  "tables": [
    { "name": "metadata",            "offset": 22,   "length": 1024, "rows": 1   },
    { "name": "vertices",            "offset": 1046, "length": 4096, "rows": 500 },
    { "name": "geometry_boundaries", "offset": 5142, "length": 2048, "rows": 200 },
    { "name": "geometries",          "offset": 7190, "length": 512,  "rows": 50  },
    { "name": "cityobjects",         "offset": 7702, "length": 1024, "rows": 50  }
  ]
}
```

## Table schemas

Each canonical table is one Arrow `RecordBatch`. The column names, Arrow data types,
and nullability listed below are normative. A conforming producer MUST emit exactly these
columns in the order listed. A conforming reader MUST validate the schema of every payload
against the canonical schema before decoding any row data.

**Projection-dependent columns** are present only when the corresponding `ProjectionLayout`
entry in the prelude or manifest is non-null. A producer MUST include such a column if and
only if the matching projection spec is non-null. A reader MUST validate projection-dependent
columns against the projection spec received in the prelude or manifest.

**Type notation:**

| Notation | Arrow type |
|---|---|
| `utf8` | `Utf8` (32-bit offsets) |
| `large_utf8` | `LargeUtf8` (64-bit offsets) |
| `uint32` | `UInt32` |
| `uint64` | `UInt64` |
| `float32` | `Float32` |
| `float64` | `Float64` |
| `fixed_size_list<T>[N]` | `FixedSizeList` with element type `T` and size `N` |
| `list<T>` | `List` with element type `T` (32-bit offsets) |
| `struct{...}` | `Struct` with named child fields |

---

### `metadata` (tag 0)

One row per encoded city model.

| Column | Type | Nullable | Description |
|--------|------|----------|-------------|
| `citymodel_id` | `large_utf8` | No | Unique identifier for the source city model |
| `cityjson_version` | `utf8` | No | CityJSON version string, e.g. `"2.0"` |
| `citymodel_kind` | `utf8` | No | Model kind; `"CityJSON"` or `"CityJSONFeature"` |
| `feature_root_id` | `large_utf8` | Yes | Root city object id for `CityJSONFeature` payloads; null otherwise |
| `identifier` | `large_utf8` | Yes | `metadata.identifier` value |
| `title` | `large_utf8` | Yes | `metadata.title` value |
| `reference_system` | `large_utf8` | Yes | CRS URI from `metadata.referenceSystem` |
| `geographical_extent` | `fixed_size_list<float64>[6]` | Yes | Bounding box `[minx, miny, minz, maxx, maxy, maxz]`; null if not set |
| `reference_date` | `utf8` | Yes | `metadata.referenceDate` |
| `default_material_theme` | `utf8` | Yes | Default material theme name |
| `default_texture_theme` | `utf8` | Yes | Default texture theme name |
| `point_of_contact` | `struct{...}` | Yes | Contact information; null if not set. See sub-fields below |
| `root_extra` | `struct{...}` | Yes | **Projection-dependent** (`root_extra`): extra top-level city model attributes |
| `metadata_extra` | `struct{...}` | Yes | **Projection-dependent** (`metadata_extra`): extra `metadata` attributes |

`point_of_contact` sub-fields:

| Sub-column | Type | Nullable | Description |
|------------|------|----------|-------------|
| `contact_name` | `large_utf8` | No | Contact person name |
| `email_address` | `large_utf8` | No | Email address |
| `role` | `utf8` | Yes | Contact role string (e.g. `"Author"`, `"Owner"`) |
| `website` | `large_utf8` | Yes | Website URL |
| `contact_type` | `utf8` | Yes | `"Individual"` or `"Organization"` |
| `phone` | `large_utf8` | Yes | Phone number |
| `organization` | `large_utf8` | Yes | Organization name |
| `address` | `struct{...}` | Yes | **Projection-dependent** (`metadata_point_of_contact_address`): address attributes |

### `extensions` (tag 2)

One row per CityJSON extension referenced by objects in this model.

| Column | Type | Nullable | Description |
|--------|------|----------|-------------|
| `extension_name` | `utf8` | No | Extension name, e.g. `"+Noise"` |
| `uri` | `large_utf8` | No | Extension schema URI |
| `version` | `utf8` | Yes | Extension version string; null if not set |

---

### `vertices` (tag 3)

One row per shared vertex coordinate.

| Column | Type | Nullable | Description |
|--------|------|----------|-------------|
| `vertex_id` | `uint64` | No | Unique vertex identifier (monotonically increasing) |
| `x` | `float64` | No | X coordinate |
| `y` | `float64` | No | Y coordinate |
| `z` | `float64` | No | Z coordinate |

---

### `template_vertices` (tag 4)

One row per vertex coordinate in a geometry template's local coordinate system.

| Column | Type | Nullable | Description |
|--------|------|----------|-------------|
| `template_vertex_id` | `uint64` | No | Unique template vertex identifier (monotonically increasing) |
| `x` | `float64` | No | X coordinate in template local space |
| `y` | `float64` | No | Y coordinate in template local space |
| `z` | `float64` | No | Z coordinate in template local space |

---

### `texture_vertices` (tag 5)

One row per UV coordinate used for texture mapping.

| Column | Type | Nullable | Description |
|--------|------|----------|-------------|
| `uv_id` | `uint64` | No | Unique UV coordinate identifier (monotonically increasing) |
| `u` | `float32` | No | U (horizontal) texture coordinate |
| `v` | `float32` | No | V (vertical) texture coordinate |

---

### `semantics` (tag 6)

One row per semantic surface definition.

| Column | Type | Nullable | Description |
|--------|------|----------|-------------|
| `semantic_id` | `uint64` | No | Unique semantic surface identifier |
| `semantic_type` | `utf8` | No | Semantic type string (e.g. `"RoofSurface"`, `"WallSurface"`) |
| `parent_semantic_id` | `uint64` | Yes | Parent semantic surface id; null if this surface has no parent |
| `attributes` | `struct{...}` | Yes | **Projection-dependent** (`semantic_attributes`): semantic surface attributes |

---

### `semantic_children` (tag 7)

One row per parent–child relationship between semantic surfaces.

| Column | Type | Nullable | Description |
|--------|------|----------|-------------|
| `parent_semantic_id` | `uint64` | No | Parent semantic surface identifier |
| `child_ordinal` | `uint32` | No | Ordinal position of this child within the parent's children list |
| `child_semantic_id` | `uint64` | No | Child semantic surface identifier |

---

### `materials` (tag 8)

One row per material definition. The schema varies based on `material_payload` in the
projection. A producer MUST append the payload columns from the projection spec
immediately after `material_id`, in the order they appear in the spec.

| Column | Type | Nullable | Description |
|--------|------|----------|-------------|
| `material_id` | `uint64` | No | Unique material identifier |
| *(payload columns)* | varies | varies | **Projection-dependent** (`material_payload`): material property columns derived from the projection spec |

---

### `textures` (tag 9)

One row per texture definition. The schema varies based on `texture_payload` in the
projection.

| Column | Type | Nullable | Description |
|--------|------|----------|-------------|
| `texture_id` | `uint64` | No | Unique texture identifier |
| `image_uri` | `large_utf8` | No | URI or path of the texture image |
| *(payload columns)* | varies | varies | **Projection-dependent** (`texture_payload`): texture property columns derived from the projection spec |

---

### `template_geometry_boundaries` (tag 10)

One row per geometry template. Encodes boundary topology using the same nested
offset-array structure as `geometry_boundaries`.

| Column | Type | Nullable | Description |
|--------|------|----------|-------------|
| `template_geometry_id` | `uint64` | No | Template geometry identifier (matches `template_geometries`) |
| `vertex_indices` | `list<uint32>` | No | Flat list of vertex indices into `template_vertices` |
| `line_offsets` | `list<uint32>` | Yes | Offsets partitioning `vertex_indices` into line segments; null for geometries without explicit line structure |
| `ring_offsets` | `list<uint32>` | Yes | Offsets partitioning `line_offsets` into rings |
| `surface_offsets` | `list<uint32>` | Yes | Offsets partitioning `ring_offsets` into surfaces |
| `shell_offsets` | `list<uint32>` | Yes | Offsets partitioning `surface_offsets` into shells (for solid geometries) |
| `solid_offsets` | `list<uint32>` | Yes | Offsets partitioning `shell_offsets` into solids (for MultiSolid) |

---

### `template_geometry_semantics` (tag 11)

One row per (template geometry, primitive) pair that has a semantic surface assignment.

| Column | Type | Nullable | Description |
|--------|------|----------|-------------|
| `template_geometry_id` | `uint64` | No | Template geometry identifier |
| `primitive_type` | `utf8` | No | Primitive kind: `"surface"`, `"point"`, or `"linestring"` |
| `primitive_ordinal` | `uint32` | No | Ordinal position of the primitive within the template geometry |
| `semantic_id` | `uint64` | Yes | Assigned semantic surface identifier; null if unassigned |

---

### `template_geometry_materials` (tag 12)

One row per (template geometry, surface, theme) material assignment.

| Column | Type | Nullable | Description |
|--------|------|----------|-------------|
| `template_geometry_id` | `uint64` | No | Template geometry identifier |
| `primitive_type` | `utf8` | No | Primitive kind: `"surface"` |
| `primitive_ordinal` | `uint32` | No | Ordinal position of the surface within the geometry |
| `theme` | `utf8` | No | Material theme name |
| `material_id` | `uint64` | No | Assigned material identifier |

---

### `template_geometry_ring_textures` (tag 13)

One row per (template geometry, surface, ring, theme) texture assignment.

| Column | Type | Nullable | Description |
|--------|------|----------|-------------|
| `template_geometry_id` | `uint64` | No | Template geometry identifier |
| `surface_ordinal` | `uint32` | No | Ordinal position of the surface within the geometry |
| `ring_ordinal` | `uint32` | No | Ordinal position of the ring within the surface |
| `theme` | `utf8` | No | Texture theme name |
| `texture_id` | `uint64` | No | Assigned texture identifier |
| `uv_indices` | `list<uint64>` | No | UV coordinate indices into `texture_vertices`, one per vertex in the ring |

---

### `template_geometries` (tag 14)

One row per geometry template definition. Instances in `geometry_instances` reference
template geometries by `template_geometry_id`.

| Column | Type | Nullable | Description |
|--------|------|----------|-------------|
| `template_geometry_id` | `uint64` | No | Unique template geometry identifier |
| `geometry_type` | `utf8` | No | CityJSON geometry type string |
| `lod` | `utf8` | Yes | Level of detail string; null if not specified |
| `extra` | `struct{...}` | Yes | **Projection-dependent** (`geometry_extra`): extra geometry attributes |

---

### `geometry_boundaries` (tag 15)

One row per non-instance geometry. Encodes boundary topology using nested offset arrays.
Each offset list has `N+1` entries for `N` items: `offsets[i]` and `offsets[i+1]`
delimit item `i`. Null offset lists indicate the geometry type does not use that
level of nesting.

| Column | Type | Nullable | Description |
|--------|------|----------|-------------|
| `geometry_id` | `uint64` | No | Geometry identifier (matches `geometries`) |
| `vertex_indices` | `list<uint32>` | No | Flat list of vertex indices into `vertices` |
| `line_offsets` | `list<uint32>` | Yes | Offsets partitioning `vertex_indices` into line segments |
| `ring_offsets` | `list<uint32>` | Yes | Offsets partitioning `line_offsets` into rings |
| `surface_offsets` | `list<uint32>` | Yes | Offsets partitioning `ring_offsets` into surfaces |
| `shell_offsets` | `list<uint32>` | Yes | Offsets partitioning `surface_offsets` into shells (for solid geometries) |
| `solid_offsets` | `list<uint32>` | Yes | Offsets partitioning `shell_offsets` into solids (for MultiSolid) |

---

### `geometry_surface_semantics` (tag 16)

One row per (geometry, surface) pair. Assigns a semantic surface to each surface of a
surface geometry.

| Column | Type | Nullable | Description |
|--------|------|----------|-------------|
| `geometry_id` | `uint64` | No | Geometry identifier |
| `surface_ordinal` | `uint32` | No | Ordinal position of the surface within the geometry |
| `semantic_id` | `uint64` | Yes | Assigned semantic surface identifier; null if unassigned |

---

### `geometry_point_semantics` (tag 17)

One row per (geometry, point) pair. Assigns a semantic to each point of a
`MultiPoint` geometry.

| Column | Type | Nullable | Description |
|--------|------|----------|-------------|
| `geometry_id` | `uint64` | No | Geometry identifier |
| `point_ordinal` | `uint32` | No | Ordinal position of the point within the geometry |
| `semantic_id` | `uint64` | Yes | Assigned semantic identifier; null if unassigned |

---

### `geometry_linestring_semantics` (tag 18)

One row per (geometry, line string) pair. Assigns a semantic to each line string of a
`MultiLineString` geometry.

| Column | Type | Nullable | Description |
|--------|------|----------|-------------|
| `geometry_id` | `uint64` | No | Geometry identifier |
| `linestring_ordinal` | `uint32` | No | Ordinal position of the line string within the geometry |
| `semantic_id` | `uint64` | Yes | Assigned semantic identifier; null if unassigned |

---

### `geometry_surface_materials` (tag 19)

One row per (geometry, surface, theme) material assignment.

| Column | Type | Nullable | Description |
|--------|------|----------|-------------|
| `geometry_id` | `uint64` | No | Geometry identifier |
| `surface_ordinal` | `uint32` | No | Ordinal position of the surface within the geometry |
| `theme` | `utf8` | No | Material theme name |
| `material_id` | `uint64` | No | Assigned material identifier |

---

### `geometry_ring_textures` (tag 20)

One row per (geometry, surface, ring, theme) texture assignment.

| Column | Type | Nullable | Description |
|--------|------|----------|-------------|
| `geometry_id` | `uint64` | No | Geometry identifier |
| `surface_ordinal` | `uint32` | No | Ordinal position of the surface within the geometry |
| `ring_ordinal` | `uint32` | No | Ordinal position of the ring within the surface |
| `theme` | `utf8` | No | Texture theme name |
| `texture_id` | `uint64` | No | Assigned texture identifier |
| `uv_indices` | `list<uint64>` | No | UV coordinate indices into `texture_vertices`, one per vertex in the ring |

---

### `geometry_instances` (tag 21)

One row per geometry that is a template instance. References a template from
`template_geometries` and a placement origin vertex from `vertices`.

| Column | Type | Nullable | Description |
|--------|------|----------|-------------|
| `geometry_id` | `uint64` | No | Unique geometry identifier |
| `cityobject_ix` | `uint64` | No | Index of the owning city object (matches `cityobject_ix` in `cityobjects`) |
| `geometry_ordinal` | `uint32` | No | Ordinal position of this geometry within the city object's geometry list |
| `lod` | `utf8` | Yes | Level of detail string; null if not specified |
| `template_geometry_id` | `uint64` | No | References a row in `template_geometries` |
| `reference_point_vertex_id` | `uint64` | No | References a vertex in `vertices` used as the instance placement origin |
| `transform_matrix` | `fixed_size_list<float64>[16]` | Yes | Column-major 4×4 transformation matrix; null if identity |
| `extra` | `struct{...}` | Yes | **Projection-dependent** (`geometry_extra`): extra geometry attributes |

---

### `geometries` (tag 22)

One row per non-instance geometry definition. Links city objects to their boundary data
in `geometry_boundaries`.

| Column | Type | Nullable | Description |
|--------|------|----------|-------------|
| `geometry_id` | `uint64` | No | Unique geometry identifier (matches `geometry_id` in `geometry_boundaries`) |
| `cityobject_ix` | `uint64` | No | Index of the owning city object (matches `cityobject_ix` in `cityobjects`) |
| `geometry_ordinal` | `uint32` | No | Ordinal position of this geometry within the city object's geometry list |
| `geometry_type` | `utf8` | No | CityJSON geometry type string (e.g. `"Solid"`, `"MultiSurface"`) |
| `lod` | `utf8` | Yes | Level of detail string; null if not specified |
| `extra` | `struct{...}` | Yes | **Projection-dependent** (`geometry_extra`): extra geometry attributes |

---

### `cityobjects` (tag 23)

One row per city object.

| Column | Type | Nullable | Description |
|--------|------|----------|-------------|
| `cityobject_id` | `large_utf8` | No | CityJSON city object identifier string |
| `cityobject_ix` | `uint64` | No | Sequential integer index; used as the join key by geometry and children tables |
| `object_type` | `utf8` | No | CityJSON object type string (e.g. `"Building"`, `"Road"`) |
| `geographical_extent` | `fixed_size_list<float64>[6]` | Yes | Bounding box `[minx, miny, minz, maxx, maxy, maxz]`; null if not computed |
| `attributes` | `struct{...}` | Yes | **Projection-dependent** (`cityobject_attributes`): typed city object attributes |
| `extra` | `struct{...}` | Yes | **Projection-dependent** (`cityobject_extra`): extra city object attributes not covered by `attributes` |

---

### `cityobject_children` (tag 24)

One row per parent–child relationship between city objects.

| Column | Type | Nullable | Description |
|--------|------|----------|-------------|
| `parent_cityobject_ix` | `uint64` | No | `cityobject_ix` of the parent city object |
| `child_ordinal` | `uint32` | No | Ordinal position of this child within the parent's children list |
| `child_cityobject_ix` | `uint64` | No | `cityobject_ix` of the child city object |

## Table schemas

Each canonical table is one Arrow `RecordBatch`. The column names, Arrow data types,
and nullability listed below are normative. A conforming producer MUST emit exactly these
columns in the order listed. A conforming reader MUST validate the schema of every payload
against the canonical schema before decoding any row data.

**Projection-dependent columns** are present only when the corresponding `ProjectionLayout`
entry in the prelude or manifest is non-null. A producer MUST include such a column if and
only if the matching projection spec is non-null. A reader MUST validate projection-dependent
columns against the projection spec received in the prelude or manifest.

**Type notation:**

| Notation | Arrow type |
|---|---|
| `utf8` | `Utf8` (32-bit offsets) |
| `large_utf8` | `LargeUtf8` (64-bit offsets) |
| `uint32` | `UInt32` |
| `uint64` | `UInt64` |
| `float32` | `Float32` |
| `float64` | `Float64` |
| `fixed_size_list<T>[N]` | `FixedSizeList` with element type `T` and size `N` |
| `list<T>` | `List` with element type `T` (32-bit offsets) |
| `struct{...}` | `Struct` with named child fields |

---

### `metadata` (tag 0)

One row per encoded city model.

| Column | Type | Nullable | Description |
|--------|------|----------|-------------|
| `citymodel_id` | `large_utf8` | No | Unique identifier for the source city model |
| `cityjson_version` | `utf8` | No | CityJSON version string, e.g. `"2.0"` |
| `citymodel_kind` | `utf8` | No | Model kind; `"CityJSON"` or `"CityJSONFeature"` |
| `feature_root_id` | `large_utf8` | Yes | Root city object id for `CityJSONFeature` payloads; null otherwise |
| `identifier` | `large_utf8` | Yes | `metadata.identifier` value |
| `title` | `large_utf8` | Yes | `metadata.title` value |
| `reference_system` | `large_utf8` | Yes | CRS URI from `metadata.referenceSystem` |
| `geographical_extent` | `fixed_size_list<float64>[6]` | Yes | Bounding box `[minx, miny, minz, maxx, maxy, maxz]`; null if not set |
| `reference_date` | `utf8` | Yes | `metadata.referenceDate` |
| `default_material_theme` | `utf8` | Yes | Default material theme name |
| `default_texture_theme` | `utf8` | Yes | Default texture theme name |
| `point_of_contact` | `struct{...}` | Yes | Contact information; null if not set. See sub-fields below |
| `root_extra` | `struct{...}` | Yes | **Projection-dependent** (`root_extra`): extra top-level city model attributes |
| `metadata_extra` | `struct{...}` | Yes | **Projection-dependent** (`metadata_extra`): extra `metadata` attributes |

`point_of_contact` sub-fields:

| Sub-column | Type | Nullable | Description |
|------------|------|----------|-------------|
| `contact_name` | `large_utf8` | No | Contact person name |
| `email_address` | `large_utf8` | No | Email address |
| `role` | `utf8` | Yes | Contact role string (e.g. `"Author"`, `"Owner"`) |
| `website` | `large_utf8` | Yes | Website URL |
| `contact_type` | `utf8` | Yes | `"Individual"` or `"Organization"` |
| `phone` | `large_utf8` | Yes | Phone number |
| `organization` | `large_utf8` | Yes | Organization name |
| `address` | `struct{...}` | Yes | **Projection-dependent** (`metadata_point_of_contact_address`): address attributes |

### `extensions` (tag 2)

One row per CityJSON extension referenced by objects in this model.

| Column | Type | Nullable | Description |
|--------|------|----------|-------------|
| `extension_name` | `utf8` | No | Extension name, e.g. `"+Noise"` |
| `uri` | `large_utf8` | No | Extension schema URI |
| `version` | `utf8` | Yes | Extension version string; null if not set |

---

### `vertices` (tag 3)

One row per shared vertex coordinate.

| Column | Type | Nullable | Description |
|--------|------|----------|-------------|
| `vertex_id` | `uint64` | No | Unique vertex identifier (monotonically increasing) |
| `x` | `float64` | No | X coordinate |
| `y` | `float64` | No | Y coordinate |
| `z` | `float64` | No | Z coordinate |

---

### `template_vertices` (tag 4)

One row per vertex coordinate in a geometry template's local coordinate system.

| Column | Type | Nullable | Description |
|--------|------|----------|-------------|
| `template_vertex_id` | `uint64` | No | Unique template vertex identifier (monotonically increasing) |
| `x` | `float64` | No | X coordinate in template local space |
| `y` | `float64` | No | Y coordinate in template local space |
| `z` | `float64` | No | Z coordinate in template local space |

---

### `texture_vertices` (tag 5)

One row per UV coordinate used for texture mapping.

| Column | Type | Nullable | Description |
|--------|------|----------|-------------|
| `uv_id` | `uint64` | No | Unique UV coordinate identifier (monotonically increasing) |
| `u` | `float32` | No | U (horizontal) texture coordinate |
| `v` | `float32` | No | V (vertical) texture coordinate |

---

### `semantics` (tag 6)

One row per semantic surface definition.

| Column | Type | Nullable | Description |
|--------|------|----------|-------------|
| `semantic_id` | `uint64` | No | Unique semantic surface identifier |
| `semantic_type` | `utf8` | No | Semantic type string (e.g. `"RoofSurface"`, `"WallSurface"`) |
| `parent_semantic_id` | `uint64` | Yes | Parent semantic surface id; null if this surface has no parent |
| `attributes` | `struct{...}` | Yes | **Projection-dependent** (`semantic_attributes`): semantic surface attributes |

---

### `semantic_children` (tag 7)

One row per parent–child relationship between semantic surfaces.

| Column | Type | Nullable | Description |
|--------|------|----------|-------------|
| `parent_semantic_id` | `uint64` | No | Parent semantic surface identifier |
| `child_ordinal` | `uint32` | No | Ordinal position of this child within the parent's children list |
| `child_semantic_id` | `uint64` | No | Child semantic surface identifier |

---

### `materials` (tag 8)

One row per material definition. The schema varies based on `material_payload` in the
projection. A producer MUST append the payload columns from the projection spec
immediately after `material_id`, in the order they appear in the spec.

| Column | Type | Nullable | Description |
|--------|------|----------|-------------|
| `material_id` | `uint64` | No | Unique material identifier |
| *(payload columns)* | varies | varies | **Projection-dependent** (`material_payload`): material property columns derived from the projection spec |

---

### `textures` (tag 9)

One row per texture definition. The schema varies based on `texture_payload` in the
projection.

| Column | Type | Nullable | Description |
|--------|------|----------|-------------|
| `texture_id` | `uint64` | No | Unique texture identifier |
| `image_uri` | `large_utf8` | No | URI or path of the texture image |
| *(payload columns)* | varies | varies | **Projection-dependent** (`texture_payload`): texture property columns derived from the projection spec |

---

### `template_geometry_boundaries` (tag 10)

One row per geometry template. Encodes boundary topology using the same nested
offset-array structure as `geometry_boundaries`.

| Column | Type | Nullable | Description |
|--------|------|----------|-------------|
| `template_geometry_id` | `uint64` | No | Template geometry identifier (matches `template_geometries`) |
| `vertex_indices` | `list<uint32>` | No | Flat list of vertex indices into `template_vertices` |
| `line_offsets` | `list<uint32>` | Yes | Offsets partitioning `vertex_indices` into line segments; null for geometries without explicit line structure |
| `ring_offsets` | `list<uint32>` | Yes | Offsets partitioning `line_offsets` into rings |
| `surface_offsets` | `list<uint32>` | Yes | Offsets partitioning `ring_offsets` into surfaces |
| `shell_offsets` | `list<uint32>` | Yes | Offsets partitioning `surface_offsets` into shells (for solid geometries) |
| `solid_offsets` | `list<uint32>` | Yes | Offsets partitioning `shell_offsets` into solids (for MultiSolid) |

---

### `template_geometry_semantics` (tag 11)

One row per (template geometry, primitive) pair that has a semantic surface assignment.

| Column | Type | Nullable | Description |
|--------|------|----------|-------------|
| `template_geometry_id` | `uint64` | No | Template geometry identifier |
| `primitive_type` | `utf8` | No | Primitive kind: `"surface"`, `"point"`, or `"linestring"` |
| `primitive_ordinal` | `uint32` | No | Ordinal position of the primitive within the template geometry |
| `semantic_id` | `uint64` | Yes | Assigned semantic surface identifier; null if unassigned |

---

### `template_geometry_materials` (tag 12)

One row per (template geometry, surface, theme) material assignment.

| Column | Type | Nullable | Description |
|--------|------|----------|-------------|
| `template_geometry_id` | `uint64` | No | Template geometry identifier |
| `primitive_type` | `utf8` | No | Primitive kind: `"surface"` |
| `primitive_ordinal` | `uint32` | No | Ordinal position of the surface within the geometry |
| `theme` | `utf8` | No | Material theme name |
| `material_id` | `uint64` | No | Assigned material identifier |

---

### `template_geometry_ring_textures` (tag 13)

One row per (template geometry, surface, ring, theme) texture assignment.

| Column | Type | Nullable | Description |
|--------|------|----------|-------------|
| `template_geometry_id` | `uint64` | No | Template geometry identifier |
| `surface_ordinal` | `uint32` | No | Ordinal position of the surface within the geometry |
| `ring_ordinal` | `uint32` | No | Ordinal position of the ring within the surface |
| `theme` | `utf8` | No | Texture theme name |
| `texture_id` | `uint64` | No | Assigned texture identifier |
| `uv_indices` | `list<uint64>` | No | UV coordinate indices into `texture_vertices`, one per vertex in the ring |

---

### `template_geometries` (tag 14)

One row per geometry template definition. Instances in `geometry_instances` reference
template geometries by `template_geometry_id`.

| Column | Type | Nullable | Description |
|--------|------|----------|-------------|
| `template_geometry_id` | `uint64` | No | Unique template geometry identifier |
| `geometry_type` | `utf8` | No | CityJSON geometry type string |
| `lod` | `utf8` | Yes | Level of detail string; null if not specified |
| `extra` | `struct{...}` | Yes | **Projection-dependent** (`geometry_extra`): extra geometry attributes |

---

### `geometry_boundaries` (tag 15)

One row per non-instance geometry. Encodes boundary topology using nested offset arrays.
Each offset list has `N+1` entries for `N` items: `offsets[i]` and `offsets[i+1]`
delimit item `i`. Null offset lists indicate the geometry type does not use that
level of nesting.

| Column | Type | Nullable | Description |
|--------|------|----------|-------------|
| `geometry_id` | `uint64` | No | Geometry identifier (matches `geometries`) |
| `vertex_indices` | `list<uint32>` | No | Flat list of vertex indices into `vertices` |
| `line_offsets` | `list<uint32>` | Yes | Offsets partitioning `vertex_indices` into line segments |
| `ring_offsets` | `list<uint32>` | Yes | Offsets partitioning `line_offsets` into rings |
| `surface_offsets` | `list<uint32>` | Yes | Offsets partitioning `ring_offsets` into surfaces |
| `shell_offsets` | `list<uint32>` | Yes | Offsets partitioning `surface_offsets` into shells (for solid geometries) |
| `solid_offsets` | `list<uint32>` | Yes | Offsets partitioning `shell_offsets` into solids (for MultiSolid) |

---

### `geometry_surface_semantics` (tag 16)

One row per (geometry, surface) pair. Assigns a semantic surface to each surface of a
surface geometry.

| Column | Type | Nullable | Description |
|--------|------|----------|-------------|
| `geometry_id` | `uint64` | No | Geometry identifier |
| `surface_ordinal` | `uint32` | No | Ordinal position of the surface within the geometry |
| `semantic_id` | `uint64` | Yes | Assigned semantic surface identifier; null if unassigned |

---

### `geometry_point_semantics` (tag 17)

One row per (geometry, point) pair. Assigns a semantic to each point of a
`MultiPoint` geometry.

| Column | Type | Nullable | Description |
|--------|------|----------|-------------|
| `geometry_id` | `uint64` | No | Geometry identifier |
| `point_ordinal` | `uint32` | No | Ordinal position of the point within the geometry |
| `semantic_id` | `uint64` | Yes | Assigned semantic identifier; null if unassigned |

---

### `geometry_linestring_semantics` (tag 18)

One row per (geometry, line string) pair. Assigns a semantic to each line string of a
`MultiLineString` geometry.

| Column | Type | Nullable | Description |
|--------|------|----------|-------------|
| `geometry_id` | `uint64` | No | Geometry identifier |
| `linestring_ordinal` | `uint32` | No | Ordinal position of the line string within the geometry |
| `semantic_id` | `uint64` | Yes | Assigned semantic identifier; null if unassigned |

---

### `geometry_surface_materials` (tag 19)

One row per (geometry, surface, theme) material assignment.

| Column | Type | Nullable | Description |
|--------|------|----------|-------------|
| `geometry_id` | `uint64` | No | Geometry identifier |
| `surface_ordinal` | `uint32` | No | Ordinal position of the surface within the geometry |
| `theme` | `utf8` | No | Material theme name |
| `material_id` | `uint64` | No | Assigned material identifier |

---

### `geometry_ring_textures` (tag 20)

One row per (geometry, surface, ring, theme) texture assignment.

| Column | Type | Nullable | Description |
|--------|------|----------|-------------|
| `geometry_id` | `uint64` | No | Geometry identifier |
| `surface_ordinal` | `uint32` | No | Ordinal position of the surface within the geometry |
| `ring_ordinal` | `uint32` | No | Ordinal position of the ring within the surface |
| `theme` | `utf8` | No | Texture theme name |
| `texture_id` | `uint64` | No | Assigned texture identifier |
| `uv_indices` | `list<uint64>` | No | UV coordinate indices into `texture_vertices`, one per vertex in the ring |

---

### `geometry_instances` (tag 21)

One row per geometry that is a template instance. References a template from
`template_geometries` and a placement origin vertex from `vertices`.

| Column | Type | Nullable | Description |
|--------|------|----------|-------------|
| `geometry_id` | `uint64` | No | Unique geometry identifier |
| `cityobject_ix` | `uint64` | No | Index of the owning city object (matches `cityobject_ix` in `cityobjects`) |
| `geometry_ordinal` | `uint32` | No | Ordinal position of this geometry within the city object's geometry list |
| `lod` | `utf8` | Yes | Level of detail string; null if not specified |
| `template_geometry_id` | `uint64` | No | References a row in `template_geometries` |
| `reference_point_vertex_id` | `uint64` | No | References a vertex in `vertices` used as the instance placement origin |
| `transform_matrix` | `fixed_size_list<float64>[16]` | Yes | Column-major 4×4 transformation matrix; null if identity |
| `extra` | `struct{...}` | Yes | **Projection-dependent** (`geometry_extra`): extra geometry attributes |

---

### `geometries` (tag 22)

One row per non-instance geometry definition. Links city objects to their boundary data
in `geometry_boundaries`.

| Column | Type | Nullable | Description |
|--------|------|----------|-------------|
| `geometry_id` | `uint64` | No | Unique geometry identifier (matches `geometry_id` in `geometry_boundaries`) |
| `cityobject_ix` | `uint64` | No | Index of the owning city object (matches `cityobject_ix` in `cityobjects`) |
| `geometry_ordinal` | `uint32` | No | Ordinal position of this geometry within the city object's geometry list |
| `geometry_type` | `utf8` | No | CityJSON geometry type string (e.g. `"Solid"`, `"MultiSurface"`) |
| `lod` | `utf8` | Yes | Level of detail string; null if not specified |
| `extra` | `struct{...}` | Yes | **Projection-dependent** (`geometry_extra`): extra geometry attributes |

---

### `cityobjects` (tag 23)

One row per city object.

| Column | Type | Nullable | Description |
|--------|------|----------|-------------|
| `cityobject_id` | `large_utf8` | No | CityJSON city object identifier string |
| `cityobject_ix` | `uint64` | No | Sequential integer index; used as the join key by geometry and children tables |
| `object_type` | `utf8` | No | CityJSON object type string (e.g. `"Building"`, `"Road"`) |
| `geographical_extent` | `fixed_size_list<float64>[6]` | Yes | Bounding box `[minx, miny, minz, maxx, maxy, maxz]`; null if not computed |
| `attributes` | `struct{...}` | Yes | **Projection-dependent** (`cityobject_attributes`): typed city object attributes |
| `extra` | `struct{...}` | Yes | **Projection-dependent** (`cityobject_extra`): extra city object attributes not covered by `attributes` |

---

### `cityobject_children` (tag 24)

One row per parent–child relationship between city objects.

| Column | Type | Nullable | Description |
|--------|------|----------|-------------|
| `parent_cityobject_ix` | `uint64` | No | `cityobject_ix` of the parent city object |
| `child_ordinal` | `uint32` | No | Ordinal position of this child within the parent's children list |
| `child_cityobject_ix` | `uint64` | No | `cityobject_ix` of the child city object |