Skip to content

Latest commit

 

History

History
100 lines (60 loc) · 4.77 KB

cityGML_to_3DTiles_example.md

File metadata and controls

100 lines (60 loc) · 4.77 KB

Example of CityGML to 3DTiles pipeline

This tutorial is an example of 3DTiles creation and visualisation. The 3DTiles are created with py3dtilers.

In this example, we use the CityGML Tiler to create 3DTiles from a 3DCityDB database.

Before using the tiler, install py3dtilers.

To create 3DTiles from OBJ, GeoJSON or IFC files, check the Tilers usage. An example of the GeojsonTiler usage is available in this tutorial.

Configure the database

Creating 3DTiles with the CityGML Tiler requires Postgres/PostGIS and 3DCityDB. The cityGML data must be hosted in a 3DCityDB database to be used by the CityGML Tiler.

Download the cityGML data from Data Grand Lyon (choose a district of Lyon, for example Lyon 1).

To host the downloaded CityGML in a local database, follow this tutorial to create a 3DCityDB database. Import the buildings into your database.

import_buildings.

You also have to copy the content of the configuration file into another file (for example py3dtilers/CityTiler/CityTilerDBConfig.yml) and add the details of your database in this new file:

PG_HOST: localhost
PG_PORT: 5432
PG_NAME: <name_of_your_database>
PG_USER: postgres
PG_PASSWORD: <user password>

Use the CityTiler

See the CityTiler usage for more details about this Tiler.

To use the Tiler, target your database config file and choose the type building:

citygml-tiler -i py3dtilers/CityTiler/CityTilerDBConfig.yml --type building

Reprojection

The Tiler allows to change the CRS of the 3DTiles. By default, the CRS of your 3DTiles will be the same as your data.

In order to change the CRS, you have to specify both input CRS (--crs_in flag) and output CRS (--crs_out flag). For example, to visualise 3DTiles in Cesium ion (EPSG:4978) with Lyon's CityGML (EPSG:3946), you have to produce 3DTiles with:

citygml-tiler -i py3dtilers/CityTiler/CityTilerDBConfig.yml --type building --crs_in EPSG:3946 --crs_out EPSG:4978

Texture

By default, the 3DTiles are created without texture. To add the texture, just add the flag --with_texture:

citygml-tiler -i py3dtilers/CityTiler/CityTilerDBConfig.yml --type building --with_texture

image
Lyon's 1st borough buildings with texture

Visualisation

To visualize your 3DTiles in Cesium ion, iTowns or UD-Viz follow this tutorial.

Cesium

Your 3DTiles must be in the EPSG:4978 to be viewed in Cesium ion (see reprojection).

The tileset is created with the command:

citygml-tiler -i py3dtilers/CityTiler/CityTilerDBConfig.yml --type building --crs_in EPSG:3946 --crs_out EPSG:4978

image

iTowns

Your 3DTiles can be in any projection (e.g. EPSG:3946 or EPSG:4978) to be viewed in iTowns, as long as you declare the correct view and coordinate system (i.e. Planar View with any planar projection such as EPSG:3946 or Globe View with EPSG:4978) (see reprojection). In this example, the 3D Tiles is in the EPSG:3946 CRS (the CRS of the input CityGML file).

The tileset is created with the command:

citygml-tiler -i py3dtilers/CityTiler/CityTilerDBConfig.yml --type building

image

UD-Viz

Similarly to iTowns, your 3DTiles can be in any projection (e.g. EPSG:3946 or EPSG:4978) to be viewed in UD-Viz, since it is based on iTowns. In this example, the 3D Tiles is in the EPSG:3946 CRS (the CRS of the input CityGML file).

The tileset is created with the command:

citygml-tiler -i py3dtilers/CityTiler/CityTilerDBConfig.yml --type building

image