How to import cityGML into Jme3?


Anyone who knows how to import cityGML into Jme3 having the same material ?

For example: i have waldbruecke_v1.0.0.gml file. I want to import it (each building or house as an object) and view it in jme3.

Many thanks for your reponse.

To do this, I used the citygml4j library ( as the bridge between citygml and jme3.
But i can’t get a full form of buildings in JME3. In my code, i still get Bounding Box form in jme3.
How to get a full form of buildings in JME3 ?

Thanks for any suggestions,

By constructing the mesh from the data in the gml file:

1 Like

Tks for your reponse.

Polygon meshes in Jme3 are made up of triangles. But i found in citygml, a mesh is built like this:


                                        <gml:posList srsDimension="3">-299.73 -167.24 0 -299.58
                                            -178.26 0 -279.09 -178.67 0 -257.83 -179.09 0
                                            -257.61 -168.09 0 -299.73 -167.24 0</gml:posList>


I do not know how to extract the mesh above for constructing the custom mesh as you said.

Correct me if i was wrong. Thanks.

i also put my question in citygml4j’s forum but has not received the answer.

Well you’ll have to dig into the documentation of citygml4j and learn more about the data. You’re basically making your own importer. If the actual mesh data isn’t in the file you’ll have to implement code that constructs it according to the citygml rules.

1 Like

I think you’re right. From my view, it is not easy to implement it. In citygml file, there are 4 levels of appearance (from simplicity to complexity), e.g. Lod 0 (regional model), lod 1 (city model - as i’ve done with Bounding box in jme3), lod 2 (city model with roof structure - custom meshes that i want to achieve), lod 3 (detailed architecture) and lod 4 (interior model). This translation work (to build the importer) requires many implementations for mapping the mesh of gml file (in any lod) to custom mesh in jme3. Maybe there was not an existing work to translate it.

Thanks to @normen anyway.

Hi @normen,

I imported sucessfully cityGML (lod2) into Jme3 (see the picture)

I post here some steps that i dit for one city object (you can do the same thing for others) :

  • Step 1 : Look up all vertices

Remember that each object in citygml (landuse, building, etc … ) are made by a set of surfaces. Each surface is a polygon having a linearRing boundary. By using citygml4j, we can get easily a set of different vertices of all surfaces for one city object.

  • Step 2 : Triangulation

Polygon meshes in Jme3 are made up of triangles. I use library QuickHull3D (QuickHull3D: A Robust 3D Convex Hull Algorithm in Java) to triangles all vertices into a set of faces (each face is a triangle).

See also this post

  • Step 3 : Build custom-mesh

Follow this to build a custom mesh with the input a set of faces got in step 2.
In my side, I am only interested in 2 factors : vertices and indexes (no texCoord, no normal …) and it works.

I would like to say thanks @Atomix for his advices.