3dcitydb / 3dcitydb-web-map

Cesium-based 3D viewer and JavaScript API for the 3D City Database
Apache License 2.0
377 stars 125 forks source link

Using 3DCityDB WFS with Web Map #77

Closed tika-iteratec closed 1 year ago

tika-iteratec commented 1 year ago

Hello,

is it possible to use the 3DCityDB WFS to display the buildings on the web map? If yes, is it also possible to enrich the models with thematic data as you can do it with KML/gITF models.

Or is there another way without exporting the KML/gITF data manually?

Thanks

thomashkolbe commented 1 year ago

Hi, no not directly. The GML encoding of CityGML is based on XML and while it could be parsed in JavaScript within a browser in order to be rendered, it will probably be rather slow. Also no tiling mechanism will be in place to prevent the browser trying read in some tens of megabyte large files which might freeze the browser.

However, if you want to give it try, you could configure the WFS to output CityJSON files instead of CityGML GML files. See here: https://3dcitydb-docs.readthedocs.io/en/latest/wfs/configuration/operations.html and look at the section on the configuration of the GetFeature operation. CityJSON can directly be loaded and parsed from Javascript. TU Delft has developed a web viewer called Ninja that should be able to directly load and visualize the CityJSON file. You could hack that viewer such that you don't have to upload the CityJSON file manually to the viewer, but to directly reference to the GetFeature operation on the 3DCityDB, which would then deliver the CityJSON file.

But still, you will run into problems when trying to visualize the 3D model for an entire city, because of the missing tiling mechanisms. Also textures wouldn't work in this setting. And Ninja only visualizes the 3D model, but no external terrain model, aerial images, etc.

Best regards Thomas Kolbe