Import 3d buildings into Cesium

I have many buildings in CityGML format. Currently cesium does not parse citygml. I tried Geojson and KML formats as in Cesium official tutorials using Sandcastle. In geojson buildings can be seen only 2d (as footprints) and in kml experience Cesium gives an error “Unsupported geometry type: model”. I want to render both 3d geometries and semantic attributes in Cesium. I have approximately 2000 buildings. So, What is the best and easiest way to visualize buildings and their attributes in Cesium? I want to develop a client application both visualize buildings and query their semantic attribute.

Hello,

Sorry, but I don’t know of any tools pubically available to process CityGML into a format that Cesium can render. Converting CityGML to 3D Tiles would be your best solution. You can learn more about the 3D tiles format in this post: https://groups.google.com/d/msg/cesium-dev/tCCooBxpZFU/7hxT_E4pGgAJ

CityGML processing is also something we are looking into adding support for in our new cesium.com application. Learn more information at https://www.cesium.com/

Best,

Hannah

What about parsing kml model geometry and convert it to cesium object? Current KMLDataSource does not support it

KML converter / parser would be good idea.

I wanted to load 3D KML file also in Cesium just like it’s done here:

http://www.3dcitydb.net/3dcitydb/fileadmin/3DWebClient/Beta3-1/main.html?config=https%3A%2F%2Fdocs.google.com%2Fspreadsheets%2Fd%2F1KcSjc1l3ejJ1XbBZEpjfc4pIISs8P9OhMu6Q9e8R_q4%2Fedit%23gid%3D478696279&lat=51.91681009584133&lon=4.4609671328876965&range=94.167&tilt=49.008&heading=0.0001&altitude=0.0001&nodeindex=0&viewer=CE

I have to find out how the people from Munich did incorporate this KML into Cesium. Till now it’s a bit difficult to find out. Would be nice if this can be done with a widget alike…

Keep you posted for my idea’s / solution.

I am also looking for a way to convert from CityGML to 3d-tiles … The problem is not the conversion, is to generate the tileset.json file automatically. I hope the cesium team is working on something. I think the link you’ve been shared is done with this (3DCityDB-Web-Map-Client), if you try it, I’d like to know your opinion about the tool.

Hi,

we have a CityGML to 3DTiles converter which is commercially available.

https://nrw.virtualcitymap.de/ - Here is an application with an example Dataset from our converter.

If you need more information you can just contact me.

Jannes

I've been looking at converting kml geometry models into czml models using the libraries I have.
Since kml models are collada and czml are glTF, the first step would be to convert using:

    https://cesiumjs.org/convertmodel.html

I wrote a few lines of code to pick the kml models info and convert to czml packets.
This works (I think) however, there are some issues like:

the kml scale is in x,y,z direction, but czml is just one number, which one to pick?
the orientation in czml uses UnitQuaternion, how to get this from the kml tilt,roll,heading?

Is anyone still interested in such conversion? If so, are there any simple example kml files around with some geometry models in it for testing?

Hi there,

I don’t know of any KML example files our team uses, but as for your two issues,

  1. CZML scale does take three parameters, in the form of a Cartesian3: https://github.com/AnalyticalGraphicsInc/czml-writer/wiki/Scale

  2. HeadingPitchRoll can be converted to a Quaternion with Quaternion.fromHeadingPitchRoll(): https://cesiumjs.org/Cesium/Build/Documentation/Quaternion.html

Keep an eye on the Documentation as you work! We have a lot of helpful workhorse functions like that on in our core Cesium library.

Hope that helps,

  • Rachel

Hi Rachel,

Re: czml scale, I was extracting the kml model scale [x,y,z] and using this to set
the czml model scale value, which takes only 1 number. But I can see that
there is a scaling factor of Cartesian3. It is not clear to me where it should be used.
Also not sure which one the czml model will use.

I did eventually see the fromHeadingPitchRoll function, which I use in my code now.

I have a test app that converts kml models from a kml document, to czml models at:

       https://github.com/workingDog/kml2czml
    
Although not really needed by Cesium users, I also have a KmlToGeojson converter at:

       https://github.com/workingDog/kmlToGeojson

Hi there,

Thanks for sharing your work!

As for the scale property, I realized that that doc page is actually misleading – you’re right, we actually only support uniform scaling for CZML/entities right now. We have an open issue for non-uniform scale right now – we’ll keep you posted if we make any progress. https://github.com/AnalyticalGraphicsInc/cesium/issues/2922

Thanks,

  • Rachel