[GIS] Convert gml to raster in QGIS

3d modelcitygmlgmlqgisrasterization

I have a dataset of type citygml (*.gml). It includes information about buildings and their rooftypes.

you can find a sample file here: https://www.opengeodata.nrw.de/produkte/geobasis/3d-gm/3d-gm_lod2/

The information about the roof is given as the attribute roofType. CAD-Software is able to visualize the buildings from the *.gml-files including their roofs. I successfully opend the data with this freeware tool:

https://www.iai.kit.edu/downloads/Informatik_fuer_die_Energiesystemanalyse/FZKViewer-4.9_Build-956.zip

If i load the file in QGIS (3.0 Girona) i see the footprints of the files.

aim:

I want to convert this data into a raster DEM (digital elevation model). This could be for example the *.xyz-format where for each x/y coordinate there is information about the height of the building including the roof (z):

x;y;z
20;15;1
15;15;1
15;0;2
20;0;2

It has to be a raster format because the DEM will go as input data to a software that only understand raster-formats.

I have come so far:
I rasterize the gml-file in QGIS using the building height from the attribute table. Then I get a DEM with cuboids with flat roofs.

here I get stuck:
I don't have any idea how to do something similar including the heigths of the roof. Somehow I need to transform the roofType into information about the altering roof height over the building footprint. Also I don't know how i access information about the roof height in this data set. I'm sure it must be there. There is an attribute named consistsOfBuildingPart/BuildingPart/measuredHeight (sample value: 2:11.788,7.645) As I understand the information of the roof is saved as a BuildingPart for each Building.

alternatives?:
I know how to convert the *.gml-data to *.stl or *.ifc format which are widely used for models of buildings e.g. in CAD-software. So if somebody knows how to rasterize those data-types instead of *.gml, hints would also be usefull.

prefered software:
any freeware:

R, QGIS

Does anybody know how to rasterize the buildings in *.gml-format in QGIS?
To me it seems like the web is full of descriptions convertig raster-dem to *.gml or different 3D-formats…

Best Answer

It sounds like you need to extract the geometry data (not attributes) from the CityGML and rasterize that into 2.5d surface model. When you say the buildings and roofs are visualised in FZK, they are presumably drawing the roof surface from the geometry for the Roof feature types, not from the roofType attribute in the CityGML. I can't look at your data to double-check what you have right now though.

If so. there was a related question on here a while ago. Conversion of OSM building to elevation raster

I don't have a tried and tested approach for you but you could try using GRASS. You can access from QGIS. Eg. try to get a triangulation / TIN of all the buildings geometry and then convert that to a raster https://grass.osgeo.org/grass74/manuals/addons/v.tin.to.rast.html

You can import from DXF v.in.dxf if you can create DXF from your CityGML

Related Question