CityGML Support in Cesium

Hi,

I am currently working with CityGML files and would like to view them on Cesium Globe.

Would it be possible for you to guide me how exactly can this be done. As I can see that KML can be supported on Cesium, is there any support for CityGML files as well?

Thanks in advance!

Kanishk

There’s not built-in support for CityGML yet, but I would love to see it added. If you have any links to example files that would be useful, that would be a great start. If you’re interested in working on support yourself, even better. Essentially, we would create a CityGmlDataSource object (much like we have for CZML and GeoJSON and are developing for KML. It’s just a matter of parsing the file and creating objects. GeoJsonDataSource would probably be a good reference to use if you wanted to play around with trying to implement it.

Hi, I just recently came across Cesium and I am pretty impressed about it.
It would be really great to be able to directly view CityGML datasets!

If you are looking for CityGML datasets you may want to check either the
CityGML homepage at http://www.citygml.org/index.php?id=1539
or have a look at our 3DCityDB homepage. 3DCityDB is an Open Source 3D database
for the storage and maintenance of CityGML with PostGIS or Oracle RDBMS.
On the homepage at http://www.3dcitydb.net/ you can find under the menu
item "Demo" two projects for which the CityGML datasets and the derived
KML/COLLADA files can be downloaded (one is a part of Berlin and the other
a part of Potsdam).

The 3DCityDB has a powerful KML/COLLADA exporter which allows to export
CityGML data for visualization purposes. Nevertheless for larger scenes, it
is using the KMLNetworkLink element in order to implement a tiling strategy to
ensure that only tiles in the vicinity of the observer are being loaded.
As far as I have seen from the Cesium Blog this capability has not been
implemented for Cesium yet. If this would be available, the exported
3D city models from 3DCityDB could be directly loaded as pure KML or KML with
COLLADA files (as used by GoogleEarth).

Best regards
Thomas H. Kolbe (I am running www.citygml.org)

Awesome. Thanks for the links. I’ll definitely keep them handy for when I have time to look into CityGML support.

Hi,

Thanks for the response!

I have been working on 3D city database since few days. Using Postdam CityGML dataset, I am able to export it as KML, which opens successfully on Google Earth/Maps.

At the same time, I have also installed czml-writer. I tried to convert some sample KML files to CZML using CesiumLanguageConverter and they opened successfully on Cesium Viewer (http://cesium.agi.com/Cesium/Build/Apps/CesiumViewer/) by simply dragging the CZML files to viewer.

Now, using CesiumLanguageConverter, I can successfully convert Postdam KML file (exported by 3D city database) to CZML format without any error. But when I try to open Postdam CZML file on Cesium viewer by dragging it, it does not do anything. Also, it does not show any JavaScript error.

As I am new to Cesium and CZML, I am struggling to understand the Postdam CZML file and to identify the issue. Is it due to complex geometries involved in KML generated from CityGML, which is not supported by CZML? But in that case, CesiumLanguageConverter should have failed at the time of conversion. Also, is there any way to check what exactly happens when I try to drag the CZML file on viewer. I am currently using Firebug in Mozilla Firefox and Developers Tools in Google Chrome and both of them do not show any error message.

Many thanks once again!

Regards,

Kanishk

Hi,

I have made a KML export of two building blocks in Berlin from our 3DCityDB
and I could successfully convert it into CZML using the online transformation tool
http://cesium.agi.com/kmlconverter/kml2czml?locationUrl=https%3A%2F%2Fdl.dropboxusercontent.com/u/24313387/KML/BerlinExcerpt_geometry.kml&f=JSON

When I load the resulting file in the CZML viewer, it shows only the building roofs
and they are clamped to the ground. Walls may be also shown, but since they are
probably also clamped to the ground they are not visible. It seems that the
CZML viewer is ignoring the absolute Z coordinate values. I had a short look at
the generated CZML file and it seems that the Z coordinates are still in there.

It would be great, if somebody from the Cesium team could have a look at it.
The data files can be downloaded from here:
CityGML: https://dl.dropboxusercontent.com/u/24313387/KML/BerlinExcerpt_geometry.gml
KML: https://dl.dropboxusercontent.com/u/24313387/KML/BerlinExcerpt_geometry.kml
CZML: https://dl.dropboxusercontent.com/u/24313387/KML/BerlinExcerpt_geometry.czml

In order to find the location on the Cesium globe, load the KML file before in
Google Earth and orient yourself. (I don't see a gazetteer / location search entry field
in the CZML viewer).

Thanks and best regards
Thomas Kolbe

Hi,

Thank you for response!

This is true that we need to manually zoom in to the specific area in Cesium viewer. It is not automatically zooming to the location when we open CZML file. But if we can determine the bounding box around specified area, as a workaround, we can add following code with bounding box values while opening the CZML file

var west = Cesium.Math.toRadians(value);

var south = Cesium.Math.toRadians(value);

var east = Cesium.Math.toRadians(value);

var north = Cesium.Math.toRadians(value);

var scene = cesiumWidget.scene;

var extent = new Cesium.Extent(west, south, east, north);

scene.getCamera().controller.viewExtent(extent);

It will open CZML file with proper extents and there will be no need to manually zoom-in to the specified location. This works for me!

Also, as mentioned, z-coordinate values in CZML file are not being considered by Cesium viewer. The building roofs appear to be clamped to the ground.

Would it be possible for someone from Cesium Team to guide how z-coordinate values can be considered by Cesium viewer.

Many thanks!

Regards,

Kanishk

hi kanishk
Can u just tell me how can i make clickable placemark in czml to use in cesium 3d globe?

Pooja, please do not ask the same question in multiple places, especially in unrelated threads. I answered your other thread, please continue conversation there.

ok sry for that i did not do this again.

Hey guys,

Im also working on a citygml project and we are looking at using cesium for visualization purposes. I was wondering what the status was on the z-coordinate problem of the czml file tested by Thomas Kolbe.

I would also be interested to know if CZML currently has a tiling strategy which would load only data in the direct area of the postion of the user?

I will perfom some tests with other CityGML data to see if the z coordinate problem occurs also with other data.

Lucas

Hi everyone,

I also tested a few CityGML datasets by converting them to CZML. The z-coordinate problem persists with all of them. This is possibly due to the reason that Cesium does not support “extruded features”. I am also observing the same issue when I convert CityGML to KML and try to open it in Google Maps (not Google Earth). It ignores z-coordinate values and building appears to be clamped.

However, as per Cesium doucmentation, there are functions like PolygonOutlineGeometry() or PolygonGeometry(), which support extrudedHeight feature. If we give coordinates of the building with extrudedHeight, the 3D buildings can be visualized on Cesium. It works for me!

But considering hundreds of buildings in one file, this is going to be a huge manual effort. That would be great, if z-coordinates from CZML file can be visualized in Cesium viewer.

Looking forward for some input/suggestion from Cesium Team.

Thanks & Regards

Kanishk

Hi all,

I agree with Kanishk, it would be great if the Cesium Team could take a look at the problem regarding the z-height of cartographicRadians (maybe a general problem?)

@Kanishk: it doesnt seem that usage of polygonoutlinegeometry() is feasible for large datasets, its cumbersome use is exactly the reason that they implement something like CZML.

Would be great to hear something from Cesium Team about this!

I’ve been meaning to jump back into this conversation for a while, but I’ve been extremely busy with work-related projects and have had very little time for core Cesium stuff lately. That being said, over the next few weeks I hope to get back finishing up some of the big changes that have already been started in the “kml” and “dynamicScene-geometry” branches

Basically, I’ve been updating CZML and our DynamicScene/DataSource layer to take advantage of the new Geometry types in Cesium. This allows for both static and dynamic 3D shapes of all types and goes a long way to allowing us to support native CityGML. In the short term, conversion to KML will probably be the easiest route to take, but longer term (early next year) we can look into adding native CityGML support so no conversion would be necessary. The online KML web service for conversion to CZML is obsolete and our recommendation for now is to use the kml branch (that branch does not have the 3D shape changes yet, but will soon). I’ll send out another update when you guys can try it out.

Here’s a screenshot of a KML file for buildings in Nashville, TN, USA to get you excited about what’s in the pipeline.

I hope this addresses everyone’s questions and issues up thread. If you guys have any questions/comments/suggestions, just let me know and I’ll try and get back to you ASAP. Thanks.

Matthew,

thank you for your response - and the sneak preview,
which looks great! I am looking forward to test the new
features with my team when you make them accessible.

I have a question concerning the future possibilities of CZML and
the DynamicScene/DataSource layer: will it allow to load
tiles of CZML data dynamically according to the visibility / proximity
of the respective region to the position of the virtual camera?
We are currently using KMLNetworkLinks with GoogleEarth
in order to implement such a behaviour which is necessary for
handling large city models.

If you need help in interpreting some CityGML details or
looking for further example data please do not hesitate to
contact me.

The following image shows a screenshot of our current
webclient for the Energy Atlas Berlin project, where we are
using CityGML building models to estimate the energy demands
of every individual building. We are applying the same tools
for some part of London, too. With the webclient the level
of retrofitting for each building can be shown and adjusted.
At the moment we are using the Google Earth browser plugin,
but I would be interested to switch to Cesium.

Screenshot of the Energy Atlas

Best regards
Thomas

Hi Matthew,

Thank you so much for response! This is going to be really helpful.

If I am correct, that will be KmlDataSource.js under ‘kml’ branch.

Eagerly waiting for it to be accessible.

Many thanks once again!

Regards,

Kanishk

Dear Matthew/Cesium Team

Just had a quick query on KmlDataSource.js and 3D shape stuff, which were discussed in previous conversations.

Is it also going to be a part of ‘b23’, which will be releasing in December?

Thanks & Regards

Kanishk

Dear Cesium Team

In relation to the KML parsing for 3D shapes as discussed in previous conversations, I further tried to explore ‘KML-dynamicScene-geometry’ branch. With the help of KmlDataSourceDisplay.js, I am able to successfully parse and visualize polygons from my KML (derived from CityGML). But again, in spite of having z-coordinates in the KML, polygons appear as 2D and not 3D.

As far as I understand, in this branch, you have introduced GeometryVisualizer.js instead of DynamicPolygonVisualizer.js and that lacks the support of extrudedHeight feature. Although, DynamicPolygon.js contains the extrudedHeight feature, but I think, it should be visualized by GeometryVisualizer.js.

Could anyone please suggest me how to go ahead in this scenario.

Thank you for your support!

Kanishk Chaturvedi

Dear Kanishk,

Where do you find the KmlDataSourceDisplay.js? Could you post the URL?

Hi

It is KmlDataSource.js and not KmlDataSourceDisplay.js (typing mistake from my side). It is not live yet, but can be found under the branch ‘kml-dynamicScene-geometry’. The URL for this file is

https://github.com/AnalyticalGraphicsInc/cesium/blob/kml-dynamicScene-geometry/Source/DynamicScene/KmlDataSource.js

Regards,

Kanishk