Preserving Textures and Georeferencing

Liz Sanderson
Liz Sanderson
  • Updated

FME Version

Introduction

In this example, we read a LOD2 CityGML model of central Rotterdam in the Netherlands and convert it to KML for viewing in Google Earth. By transforming CityGML to KML, we can situate the model on the Earth’s surface, and we can easily share it with anyone with Google Earth installed.

In this example, the 3D geometries are converted from solids to surfaces by triangulation and then converted into one large mesh. This is the optimal geometry for writing to KML/COLLADA. The texture appearances are automatically preserved by FME. So if you were to use your own source data that contains textures, the KML you write out will also contain those textures. Viewing the output in Google Earth demonstrates that the model has been read and georeferenced correctly. Note that due to memory limitations, at present this workspace only runs on FME 64bit.

 

Step-by-step Instructions

1. Read source

The source data is the CityGML model, Kop_van_zuid.xml, translated as ‘Head of South’, and is comprised of a few high rises in central Rotterdam. Note that while the extension is XML, CityGML datasets are comprised of XML files. The data, which includes high-resolution textures, is then reprojected to a local coordinate system of the Netherlands. Only the textured feature types WallSurface and RoofSurface are selected as the source for this translation. Including the GroundSurface would not improve the output since the KML displays the data in Google Earth.
 

2. Create a single mesh

The most efficient way to store the model without losing any information is to create a single mesh out of all the building features. Before the MeshMerger can merge the features, they need to be disaggregated and triangulated, using the Deaggregator transformer and the Triangulator . Their triangulated surfaces can then be connected and stored in a single feature. The information of the features’ textures is automatically preserved. If you wish to run your workspace at this time, remember to set the ‘Rejected Feature Handling’ in the Workspace Parameters to ‘Continue Translation’, so rejected features do not terminate the translation.
 

3. Reproject and Write to KML

Before the data is written to KML it is reprojected to the LL-WGS84 coordinate system. KML always needs to be written in this projection. Make sure to adjust the advanced writer parameters in order for Google Earth to be able to read the KML file and draw the geometry correctly. In your Navigator, locate the OGCKML Writer, go to Parameters, then Advanced, and adjust the following if they are not already set:

 

4. Viewing in Google Earth

Once written, and opened in Google Earth, it is easy to see that the buildings embedded or referenced within the KML file are accurately georeferenced with respect to Google’s satellite imagery. You can also turn on and off Google’s buildings layer and compare their buildings with the ones from this exercise. At the time of writing, it appears that some of the buildings are missing or only partially completed since Google’s data may be older, though this is likely to change over time as their data is updated.

 

Completed Workspace

citygml-to-kml-workspace.png

Results in Google Earth


Select the 3D Buildings layer to compare your KML model with the available satellite imagery from Google Earth. You can consider turning off all the other layers for viewing as we will not be needing them.

google-earth-layers.png

 

Data Attribution

The data used here is obtained from open data made available from Rotterdam Open Data in the Netherlands, under Datasets, Rotterdam 3D bestanden, and then Kop Van Zuid is the name of the dataset

 

Was this article helpful?

Comments

0 comments

Please sign in to leave a comment.