cj_to_gltf
Scripts to load CityJSON files exported by the other scripts and export to a dual CityJSON/glTF format by transferring all the geometry to glTF.
Classes:
| Name | Description |
|---|---|
Cityjson2Gltf |
Load a CityJSON file and transforms it into a pair formed by a glTF file storing the geometry and a CityJSON file storing the attributes. |
Cityjson2Gltf
Bases: data_pipeline.cj_loading.cj_loader.CityjsonLoader
Load a CityJSON file and transforms it into a pair formed by a glTF file storing the geometry and a CityJSON file storing the attributes.
The hierarchy of the CityJSON file is fully preserved, only the geometry is removed and stored in glTF, with identifiers of the form <cityjson_key>-lod_<lod>.
The hierarchy of the CityJSON file is also reproduced in glTF, with all LoDs stored as children of their main object, which has no geometry.
Methods:
| Name | Description |
|---|---|
export |
Export the dual representation into the given folder. |
make_gltf_scene |
Create the scene for glTF, preserving the structure from the CityJSON input. |
Source code in python/src/data_pipeline/cj_loading/cj_to_gltf.py
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 | |
export(output_folder, overwrite=False)
Export the dual representation into the given folder.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
output_folder
|
pathlib.Path
|
The path to the folder where the files should be written. |
required |
overwrite
|
bool
|
Whether to overwrite the files if they exist. By default False. |
False
|
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If the path of any of the two outputs already exists and |
Source code in python/src/data_pipeline/cj_loading/cj_to_gltf.py
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 | |
make_gltf_scene()
Create the scene for glTF, preserving the structure from the CityJSON input.
Source code in python/src/data_pipeline/cj_loading/cj_to_gltf.py
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 | |