Creating a building based on citygml4j at LoD3 and LoD4

298 Views Asked by At

I have been trying to generate a building model based on citygml4j at different levels of details. I could generate simple models up to LoD2. I want to add some more details like doors and windows and interior geometries to the models. Are there any sample java codes for creating a building at higher LODs?

Thanks a lot for your help in advance!

1

There are 1 best solutions below

0
On

The citygml4j object model closely follows the XML encoding of CityGML. So the CityGML XML schemas and the CityGML specification document are of help.

Check out the following CityGML snippet of a building having a wall surface and a door. To keep it simple, I have omitted any spatial or thematic properties.

<bldg:Building>
  ...
  <bldg:boundedBy>
    <bldg:WallSurface>
      ...
      <bldg:opening>
        <bldg:Door>
        ...
        </bldg:Door>
      </bldg:opening>
    </bldg:WallSurface>
  </bldg:boundedBy>
</bldg:Building>

Note that the Door feature is connected to the WallSurface through the opening feature property. Likewise, the Building feature has a boundedBy feature property that contains the WallSurface.

Now, simply build the same hierarchy with citygml4j objects.

// create building, wall surface and door
Building building = new Building();
WallSurface wallSurface = new WallSurface();
Door door = new Door();

// add door to wall surface through an opening property
OpeningProperty opening = new OpeningProperty(door);
wallSurface.addOpening(opening);

// add wall surface to building through boundedBy property
BoundarySurfaceProperty boundedBy = new  BoundarySurfaceProperty(wallSurface);
building.addBoundedBySurface(boundedBy);

Finally, add some geometry and attributes. For instance, add a gml:MultiSurface as LoD 3 representation of the WallSurface.

MultiSurface geometry = new MultiSurface();
// ... add surface members containing the vertices ...

// add geometry to the wall surface
wallSurface.setLod3MultiSurface(new MultiSurfaceProperty(geometry));

Again, how to construct the GML geometry objects closely follows the XML schema. citygml4j is shipped with a lot of sample code. Check out the BuildingCreator.java sample that illustrates how geometries can be created. But you can also populate the geometry objects in different ways.

Hope this helps.