EXTRACTION AND VISUALIZATION OF 3D BUILDING MODELS IN URBAN AREAS FOR FLOOD SIMULATION

Floods pose a risk that is likely to worsen in the future due to climate change. Therefore, it is essential that decision makers and domain experts have the tools to evaluate the effects of floods. We developed a tool that visualizes the earth and buildings in three dimensions to simulate floods so that effective strategies can be developed to enhance resilience and mitigate the effects of floods. We opted to use open standards and free and open source software (FOSS) for Web to maximize interoperability, replicability, reusability, and accessibility. As a result of the literature review, we decided to use CityGML and CesiumJS for three-dimensional geospatial data visualization. However, as CityGML data is not available for the cities that our project focuses on, we developed software called shp2city that converts Esri shapefile to CityGML data in LOD1 or LOD2. Moreover, as CityGML data cannot be immediately used with CesiumJS, we used 3DCityDB to store, represent, and manage the CityGML data; 3DCityDB Importer/Exporter to export the CityGML data in KML/COLLADA/glTF format to be used within the 3DCityDB Web-Map-Client that is based on CesiumJS for visualization. Finally, we simulated floods to aid in the informed decision-making process regarding adaptation measures and mitigation of flooding effects.


INTRODUCTION
Climate change has already affected the rainfall rates and ocean levels, and the situation is likely to exacerbate (Intergovernmental Panel on Climate Change, 2014). Today, 55% of the world's population lives in urban areas, which is expected to increase to 68% by 2050 (United Nations, Department of Economic and Social Affairs, Population Division, 2018), and almost two-thirds of urban settlements with populations higher than 5 million are in the low-elevation coastal zone (LECZ) (McGranahan et al., 2007), as a result, vulnerable to rising sea levels due to climate change. Hence, millions of people are exposed to the risk of floods. Therefore, having the tools to assess the severity of the danger floods pose in different parts of the urban areas is valuable to decision makers and domain experts so that adaption and mitigation strategies for the threats of floods can be more effectively developed. 3D visualization has been used in various applications (Brovelli and Zamboni, 2012, Valentini et al., 2014, Brovelli et al., 2016, Pirotti et al., 2017. Leskens et al. performed a user study to compare the 2D and 3D visualization of flooding in the same area and found out that 3D visualization is the most suitable for flood visualization to estimate the damages to houses, loss of lives, and whether evacuation is necessary or not. The participants also stated that 3D visualization is more realistic, detailed, and vivid so that it is easier to imagine the consequences of a flood and empathize with the situation (Leskens et al., 2017). 3D geographic information system (GIS) technologies are possibly the best candidates to visualize floods, and they can also be used to manage and analyze the data related to floods. * Corresponding author The use of open standards and free and open source software (FOSS) increases interoperability, replicability, and reusability. Moreover, using web technologies increases the accessibility among different devices and operating systems. There is a number of open standards that exist for three-dimensional (3D) geographic data visualization on Web, among which the most prominent ones are VRML, X3D, KML/COLLADA, glTF, binary glTF, B3DM, CityGML, and CityJSON (Zlatanova et al., 2012, Schilling et al., 2016. CityGML is an international standard of the Open Geospatial Consortium (OGC). It is a data model and XML-based format for the storage and exchange of 3D city models. CityGML has become the most widely used standard due to the support of a wide range of geospatial software. CityGML has been used for various applications, such as noise propagation simulation and mapping, energy-related assessments of buildings, indoor navigation, disaster management, homeland security, etc. (Gröger andPlümer, 2012, Biljecki et al., 2015) The free and open source libraries that are capable of using a subset of these standards are WebGL, SpiderGL, lightgl.js, Three.js, X3DOM, and virtual globe libraries such as CesiumJS and NASA Web WorldWind.
There have been several frameworks proposed to visualize CityGML data on Web (Mao, 2011). In addition to the frameworks described in the Ph.D. thesis of Mao (2011), CityGML data converted to X3D format and accessed via WFS and W3DS was visualized using X3DOM for documenting built heritage (Prieto et al., 2012). Web3DGIS system was developed that converts CityGML to X3D, which can be viewed on the Web using X3DOM. The system allows the query of attributes and adjacency relationships of features in the X3D dataset (Rodrigues et al., 2013). In the i-SCOPE project, tiled CityGML and extended NASA Java WorldWind were used to visualize the city of Trento to provide smart city services such as solar potential assessment and noise mapping (Prandi et al., 2013).
CesiumJS has been used for visualization and analysis of CityGML data of Potsdam converted to KML/COLLADA format using 3D City Database (3DCityDB) Importer/Exporter (Yao et al., 2018, Chaturvedi, 2014. CityGML converted to KML using 3DCityDB Importer/Exporter was visualized for assessing the energy performance of buildings using WebGL (Giovannini et al., 2014). Moreover, several case studies in Mainz and Villingen-Schwenningen in Germany have been carried out that use X3DOM and Three.js. CityGML has been converted to X3D using CityServer3D software and to COLLADA in these case studies (Krämer and Gutbell, 2015). CesiumJS and extended NASA Java WorldWind have been used to visualize CityGML data of Rotterdam converted to glTF and OBJ compatible C3D format using 3DCityDB Importer/Exporter (Prandi et al., 2015). CesiumJS has been used to visualize, query, and analyze the buildings of New York and London in CityGML format exported to KML/COLLADA using 3DCityDB Importer/Exporter (Chaturvedi et al., 2015). CityGML data converted to KML using 3DCityDB Importer/Exporter was received through WFS by CesiumJS to visualize an electric power system (He et al., 2016).
3DCityDB Web-Map-Client (Yao et al., 2018) based on CesiumJS and CityGML via WFS are used to build a Smart District Data Infrastructure (SDDI) in the district Queen Elizabeth Olympic Park in London. (Chaturvedi et al., 2018).
CityGML data of New York has been converted to KML/glTF using 3DCityDB Importer/Exporter and visualized using 3DCityDB Web-Map-Client for solar irradiation analysis and traffic simulations; virtualcitySUITE, a 3DCityDB-based software from virtualcitySYSTEMS GmbH (VCS) and novaFACTORY, a 3DCityDB-based software from M.O.S.S. Computer Grafik Systeme GmbH (MOSS) have been used in cities worldwide (Yao et al., 2018). CityGML Energy Application Domain Extension (ADE) (Agugiaro et al., 2018) that extends the CityGML 2.0 standard with energy-related entities and attributes, 3DCityDB and CesiumJS were used to assess the energy performance of the building stock in northern Italy (Pasquinelli et al., 2019).
CesiumJS is an open source library that offers high-performance and cross-platform visualization and exploration of 3D geographic data on Web. Among the tools that can visualize data in CityGML or formats that can be converted to CityGML on Web, CesiumJS surpasses the rest as it supports various spatial reference systems, standard data formats, and OGC standards; streams terrain; has means to define interaction; uses WebGL which provides hardware-accelerated graphics and as a result improves the performance significantly while handling large complex 3D city models; has an active community. Moreover, it is easy to use due to its well-structured codebase and documentation (Chaturvedi, 2014, Krämer andGutbell, 2015).
The URBAN GEO BIG DATA project 1 aims to develop 1 http://www.urbangeobigdata.it/ innovative GIS tools that use big data from various sources to understand several urban dynamics better and as a result, manage urban resources and infrastructures more effectively. The data sources that enable to monitor the status of the urban areas include the traditional datasets such as topographic databases, LiDAR data and statistical data; earth observation data; the data from Web 2.0, such as volunteered geographic information (VGI) and data from social networking services; passive geo-crowdsourced data, such as SMS, phone calls etc. The GIS tools developed within the project aim to enable the visualization, query, and analysis of these data sources. The project focuses on five main cities in Italy, which are Milan, Naples, Rome, Padua, and Turin.
One of the use cases within this project is 3D visualization and query of city models, in particular, buildings for flood simulation. In literature, there are several approaches to simulate floods in three dimensions on the Web. The hydrologic model r.lake from the GRASS library, MIKE 21 hydrodynamic simulation tool, and ANUFLOOD software were used with CesiumJS (Rajabifard et al., 2015). ANUGA hydrodynamic modeling tool and CityJSON converted to glTF were used with CesiumJS (Kumar et al., 2018). 3D models of buildings in multipatch geometry format were used with Three.js (Herman et al., 2017). As CityGML has become the most widely used open standard for the representation and exchange of 3D city models and CesiumJS surpasses the other open source libraries that are capable of reading 3D geographic data formats, we opted for 3DCityDB for visualization and query of buildings. However, as CityGML data is not available for the cities mentioned above, we developed software that converts Esri shapefile to CityGML, called shp2city (Fissore and Pirotti, 2018), which we explain in detail in Section 2. Section 3 gives details on the method we used to visualize the generated CityGML data using shp2city and simulate floods. Section 4 discusses the results and lays out the ways the research may follow to improve them.

CITYGML EXTRACTION
In order to convert Esri shapefile to CityGML automatically, we developed software called shp2city. shp2city is a Python package that uses mainly GeoPandas and lxml Python libraries. We use GeoPandas to work with geospatial data and lxml to process XML and HTML efficiently. shp2city is a command-line program without a graphical interface. We developed the software with a modular software architecture that performs two essential operations to complete the process of conversion from Esri shapefile to CityGML. The first operation performs a spatial join between several shapefiles uploaded by the user. This operation is necessary in order to gather in only one shapefile the properties of geometries distributed over several files. The second operation, starting from the geometries stored in the dataset previously created, constructs the CityGML model and writes the result in a file.
The user must indicate several parameters to complete the conversion procedure, specifically the name of output CityGML file, the paths of input files, and a spatial relationship parameter (intersects, within or contains) that is used to perform a spatial join between multiple files. In case there is only one input file, the spatial join step is skipped, and the CityGML file is created from the single input file where all the null geometries are removed. In order to generate an enriched 3D model of buildings, the user is required to indicate in which fields of the input dataset The International Archives of the Photogrammetry, Remote Sensing and Spatial Information Sciences, Volume XLII-2/W11, 2019 GEORES 2019 -2nd International Conference of Geomatics and Restoration, 8-10 May 2019, Milan, Italy some properties of the features essential to the creation of the 3D model are stored. The mandatory fields that must be filled are the one containing a unique identifier of the building and the one indicating the height. For every building or building part, the generalized outer shell is represented by exactly one prismatic solid.
It is necessary to know the height of the prism to generate it. The height of each building from the ground is determined by the user, who selects the field of the attribute table of the shapefile that has the corresponding information. The height of prism equivalent to the eaves height is required to generate a CityGML model with a level of detail 1 (LOD1). If the shapefile does not have the eaves height, CityGML model is generated with a level of detail 0 (LOD0). Other information contained in the shapefile is not essential to generate the model, yet are included in order to enrich the thematic information. Some attributes that can be added to the model are the type of building, the year of construction, and an identifier to the architectural elements.
Finally, to validate the CityGML model and fix errors caused by the process performed by shp2city, we used two external web tools: CityGML-schema-validation 2 and val3dity (Ledoux, 2013), developed by the 3D geoinformation research group at TU Delft.

VISUALIZATION OF CITYGML DATA ON WEB
3DCityDB is an open source software that allows to import, manage, analyze, visualize, and export CityGML data. The development of 3DCityDB started in 2003, and since 2013 it is developed at the Chair of Geoinformatics of Technical University of Munich (TUMGI) in collaboration with the companies VCS and MOSS. Starting from version 3.3.0, 3DCityDB software comes with 3DCityDB Web-Map-Client, which serves as a web client for 3D visualization and interactive exploration of arbitrarily large semantic 3D city models. 3DCityDB Web-Map-Client implements various extensions to the CesiumJS library. Most importantly, it allows visualizing large and tiled data in glTF format. In addition, highlighting 3D objects on mouse-over and mouse-click is supported. Moreover, it implements a cloud-based online spreadsheet application programming interface (API), i.e., the Google Fusion Tables API, to query thematic information of 3D objects. When a user clicks on a 3D object, the linked Google Fusion Table is queried for the respective row, and all of its attributes are displayed in a box.
In this work, we used the CityGML data generated through shp2city software. The data is currently generated for Milan, Naples, Padua, and Turin. Using 3DCityDB Importer/Exporter, we imported the datasets into the PostgreSQL database extended with PostGIS. Then, using the same tool, we exported them to KML/COLLADA/glTF. Moreover, using the Spreadsheet Generator Plugin (SPSHG), we exported the thematic data of 3D objects into tables in CSV format and imported the data into Google Fusion Tables. Eventually, one table is generated for each city in the Google Cloud. As a result, it is possible to query each building and display its attributes in a box using the thematic data stored in the Google Fusion Tables.
We used VR-TheWorld Server to construct terrain. It provides digital elevation model (DEM) with a 90-meter resolution for the entire globe, including bathymetry. Since the buildings in 2 http://geovalidation.bk.tudelft.nl/schemacitygml/ CityGML data also have the altitude values, we could place the buildings on the terrain. We set the altitude mode to absolute and altitude offset to no offset in the settings of 3DCityDB Importer/Exporter to achieve this. Once the data is exported, we used them within the 3DCityDB Web-Map-Client. In the web GIS, we provide seven basemap alternatives, which are Bing Maps Aerial, Mapbox Satellite Streets, Planet imagery, OpenStreetMap, CARTO Dark, Stamen Terrain, and Stamen Watercolor. On the web GIS, it is also possible to simulate the sun, which enables to visualize shadows of terrain and buildings at different times of the day and year. In Figure 1, the CityGML data exported in KML/COLLADA/glTF format using 3DCityDB Importer/Exporter, imported into the web GIS built through the 3DCityDB Web-Map-Client, visualized together with its thematic data displayed in a box can be seen.

Figure 1. Visualization and query of Milan Cathedral
Moreover, we added flood simulation into the web GIS. For this, we placed a semi-transparent polygon on the ellipsoid surface of the virtual globe and let the users change the height of the polygon in meters. This results in a flood simulation that can be seen for the city of Naples in Figure 2. The 3D visualization and query of buildings with a simulated flood can be seen in Figure 3.  DTM of Milan into the virtual globe was creating terrain tiles 4 in quantized-mesh-1.0 format 5 . Then, we used a server 6 to host the tiles and referred to this server in the client built with CesiumJS to retrieve them. Following this approach, it is not possible to simulate floods in different parts of the world as the DTM is only for Milan unless additional local DEM/DTM is found and integrated into the virtual globe.

CONCLUSION AND FUTURE WORK
This article introduced a tool that converts Esri shapefile to CityGML. The results of this conversion, which are the 3D models of buildings, can be successfully visualized and queried on a virtual globe. Moreover, flood simulation can be integrated into this system. Simulating floods in three dimensions can aid in the decision making process regarding developing adaption measures and mitigating the effects of floods. Alternatively, the CityGML data could be converted to B3DM format, which is part of 3D Tiles open specification 8 , to be visualized using CesiumJS, however currently a free and open source software does not exist for this conversion. This approach would eliminate the need to use 3DCityDB and enable us to compare their performance, however as the URBAN GEO BIG DATA project uses only free and open source software, this alternative cannot be adopted. In the future, we plan to use a hydrodynamic modeling tool so that other variables than terrain can be taken into consideration in the flood simulation.