3DGI / tyler

Tiling 3D city models encoded in CityJSON
Apache License 2.0
29 stars 4 forks source link

tyler did not find any CityJSONFeature #43

Closed baal-lgln closed 10 months ago

baal-lgln commented 10 months ago

I'm currently struggling with tyler creating 3d tiles from a CityGML tile (tried some tiles from https://opengeodata.lgln.niedersachsen.de/#lod2).

My current workflow is converting citygml file to cityjson with

docker run --rm -u 1000 -v "$(pwd)":/data citygml4j/citygml-tools:latest to-cityjson *.gml

Then converting cityjson to jsonl with cjio:

docker run --rm  -u 1000 -v "$(pwd)":/data tudelft3d/cjio:latest cjio ./cityjson/LOD2_24285786_2_2020-10-06.json export jsonl ./cityjsonline/LOD2_24285786_2_2020-10-06.city.jsonl

I then try to run tyler with following settings:

docker run --rm  -u 1000 -v "$(pwd)":/data 3dgi/tyler:0.3.8 tyler \
    --metadata /data/cityjson/LOD2_24285786_2_2020-10-06.json \
    --features /data/cityjsonline \
    --output /data/3dtiles \
    --3dtiles-implicit \
    --3dtiles-metadata-class building --object-type Building --object-type BuildingPart

Which only leads to this error:

thread 'main' panicked at 'Did not find any CityJSONFeature of type Some([Building, BuildingPart]) in /data/cityjsonline', src/parser.rs:109:17
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

The cjio export function is only creating one jsonl file with all features of this cityjson tile. That differs from the tyler docs where it wants a directory (or directory tree) of .city.jsonl files, each containing one CityJSON Feature, including all its children City Objects. Splitting the jsonl file would lead to thousands of files. Why is tyler expecting one file per CityJSON Feature? Is there any tool that creates this file structure from a citygml or cityjson file?

I've uploaded the test and converted data to https://github.com/baal-lgln/citygml-to-3d-tiles/blob/main/LOD2_24285786.zip and https://github.com/baal-lgln/citygml-to-3d-tiles/blob/main/LOD2_24285786_2_2020-10-06.gml.zip.

baal-lgln commented 10 months ago

Running with RUST_LOG=debug and RUST_BACKTRACE=1 gives some more output:

[2023-10-30T13:41:10Z DEBUG tyler] Cli { metadata: "/data/cityjson/LOD2_24285786_2_2020-10-06.json", features: "/data/cityjsonline", output: "/data/3dtiles", object_type: Some([Building, BuildingPart]), object_attribute: None, cesium3dtiles_metadata_class: Some("building"), cesium3dtiles_implicit: true, cesium3dtiles_tileset_only: false, cesium3dtiles_content_bv_from_tile: false, cesium3dtiles_content_add_bv: false, geometric_error_above_leaf: Some(12.0), grid_cellsize: Some(250), grid_file: None, grid_minz: None, grid_maxz: None, grid_export: false, grid_export_features: false, debug_load_data: None, qtree_capacity: Some(42000), exe_geof: None, reduce_vertices: Some(0.05), timeout: None, lod_building: None, lod_building_part: None, lod_building_installation: None, lod_tin_relief: None, lod_road: None, lod_railway: None, lod_transport_square: None, lod_water_body: None, lod_plant_cover: None, lod_solitary_vegetation_object: None, lod_land_use: None, lod_city_furniture: None, lod_bridge: None, lod_bridge_part: None, lod_bridge_installation: None, lod_bridge_construction_element: None, lod_tunnel: None, lod_tunnel_part: None, lod_tunnel_installation: None, lod_generic_city_object: None, color_building: None, color_building_part: None, color_building_installation: None, color_tin_relief: None, color_road: None, color_railway: None, color_transport_square: None, color_water_body: None, color_plant_cover: None, color_solitary_vegetation_object: None, color_land_use: None, color_city_furniture: None, color_bridge: None, color_bridge_part: None, color_bridge_installation: None, color_bridge_construction_element: None, color_tunnel: None, color_tunnel_part: None, color_tunnel_installation: None, color_generic_city_object: None }
[2023-10-30T13:41:10Z INFO  tyler] tyler version: 0.3.8
[2023-10-30T13:41:10Z DEBUG tyler] exe_geof is not set for generating 3D Tiles, defaulting to 'geof' in the filesystem PATH
[2023-10-30T13:41:10Z INFO  tyler] geof version:
    Geoflow 0.3.6
    compiled with GNU v12.2.0 (Release)
    Loaded /usr/local/lib/geoflow-plugins/gfp_gdal.so
    Loaded /usr/local/lib/geoflow-plugins/gfp_val3dity.so
    Loaded /usr/local/lib/geoflow-plugins/gfp_buildingreconstruction.so
    Loaded /usr/local/lib/geoflow-plugins/gfp_las.so
    Loaded /usr/local/lib/geoflow-plugins/gfp_core_io.so
    GF_PLUGIN_FOLDER = /usr/local/lib/geoflow-plugins
     > io-las 0.3.1
       compiled with GNU v12.2.0 (Release)
     > CoreIO 0.3.8
       compiled with GNU v12.2.0 (Release)
     > Val3dity 0.3.0
       compiled with GNU v12.2.0 (Release)
     > io-gdal 0.3.1
       compiled with GNU v12.2.0 (Release)
     > building-reconstruction 0.3.6
       compiled with GNU v12.2.0 (Release)
     > Core [built-in]

[2023-10-30T13:41:10Z DEBUG tyler] SubprocessConfig { output_extension: "glb", exe: "geof", script: "/usr/src/tyler/resources/geof/createGLB.json", timeout: None }
[2023-10-30T13:41:10Z WARN  tyler] PROJ_DATA environment variable is not set
[2023-10-30T13:41:10Z DEBUG tyler] DebugData { world: None, quadtree: None, tiles_results: None }
[2023-10-30T13:41:10Z INFO  tyler::parser] Computing extent from the features of type Some([Building, BuildingPart])
[2023-10-30T13:41:10Z DEBUG tyler::parser] Found 0 subdirectories and 1 CityJSONFeature files at the root directory
[2023-10-30T13:41:10Z WARN  tyler::parser] Failed to parse "/data/cityjsonline/LOD2_24285786_2_2020-10-06.city.jsonl"
thread 'main' panicked at 'Did not find any CityJSONFeature of type Some([Building, BuildingPart]) in /data/cityjsonline', src/parser.rs:109:17
stack backtrace:
   0: rust_begin_unwind
             at ./rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/std/src/panicking.rs:593:5
   1: core::panicking::panic_fmt
             at ./rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/core/src/panicking.rs:67:14
   2: tyler::parser::World::new
   3: tyler::main
balazsdukai commented 10 months ago

Hi, yes indeed, tyler expects one CityJSONFeature per file, because this structure fits best into our workflow where we use tyler.

As you noticed, cjio does not produce this output. There is a python script in this repo to split CityJSON files, you can adapt that to your needs, https://github.com/3DGI/tyler/blob/master/resources/python/split_to_features.py.