# Creating Interactive 3D Web Maps with CesiumJS and 3D City Models

### Step 1: Preparing 3D City Models

In this step, we will download the 3D city models in CityGML format. Then, convert the models to 3D Tiles format for optimizing the 3D web visualization. In this article, I picked the 3D city models from Den Haag area as it is a compact model. Of course, you are free to explore this method with any CityGML datasets.

- Download the CityGML dataset from https://denhaag.dataplatform.nl/#/data/36049d1a-4a0f-4c5d-8adb-21dbfb7252f9 in the download section.
- Using the FME Workbench to convert the CityGML models to 3D Tiles format. Starting by opening the FME Workbench, Drag and drop all CityGML models to the FME window.
- Select input Format "CityGML" and Workflow option "Single Merged Feature Type".
- Click on "Add a new writer" button and select Format "Cesium 3D Tiles"
- The workflow should look like following figure. Click Run and then wait until the conversion complete. Then, the final 3D Tile City Models will be in the destination folder you input.

### Step 2: Preparing HTML for CesiumJS

In this step, we will create an HTML web document containing the 3D Web Globe using CesiumJS library. You can use any code Idle or editor. In this example, I named it as denHaagApp.html. You can create the document with the name you like and copy the following code. Don't forget to specify the URL on line 24 to the target Tileset.json. If you do this for the first time, you can come back after you set up the web server in step three.

### Step 3: Host the 3D Web App on the Web Server

This steps, we will host the Web App from step 2 and the 3D Tiles city models from step 1 on the web server. You are freely to use any web server of your preferences. In this example, we use the XAMPP open source web server. (You can get it from https://www.apachefriends.org/index.html)
- Install XAMPP
- Open XAMPP Control Panel and start APACHE web server.
- Place the web document (denHaagApp.html) from step 2 and a folder of 3D Tiles city models from step 1 in the C:\xampp\htdocs directory.
- In the html web document, update the URL value to the tileset.json file of your 3D Tiles model in the htdocs folder. For example, if your 3D Tiles directory is at C:\xampp\htdocs\3dtile\tileset.json. You should set the url value to "./3dtile/tileset.json" or "http://localhost/3dtile/tileset.json" as APACHE will serve everything in the htdocs directory relatively to "http://localhost".
- Finally, you can access your 3D web app visualizing 3D city model on your web browser at http://localhost/denHaagApp.html

## Overview of the software used

- CesiumJS
- Web Server: Apache HTTP Server , is also in XAMPP included
- Web browser: Firefox
- FME Workbench 2020

## Other Example Use Cases

- Wind Simulation Platform in the Cesium 3D Web Application
- 3D Visualization Server for hosting 3D building models created by the 3D GeoVolumes API (3D Container API) Specification
- OGC 3D IoT Pilot - Sejong, South Korea with air quality sensor data (SensorThings API)
- Explore other CityGML Datasets

## Copyright

The texts and images provided in the blog are under the CC BY 3.0 DE license.

## Author

Thunyathep Santhanavanich (JOE) PhD candidate
Faculty of Geomatics, Computer Science and Mathematics,
University of Applied Sciences Stuttgart, Schellingstr. 24, D-70174 Stuttgart
thunyathep.santhanavanich@hft-stuttgart.de