The CityTiler is a Python tiler which creates 3DTiles (.b3dm) from 3DCityDB databases.
The tiler can create 3DTiles of buildings, terrains and water bodies.
If you want to create your own local 3DCityDB databases, follow the 3DCityDB tutorial
Copy and customize the CityTilerDBConfigReference.yml file to provide database information.
You can then run the tiler by specifying the path to the .yml configuration file:
citygml-tiler -i <path_to_file>/Config.yml
The created tileset will be placed in a folder named junk_<objects-type>
in the root directory. The name of the folder will be either junk_buildings
, junk_reliefs
, junk_water_bodies
or junk_bridges
, depending on the objects type (respectively building
, relief
, water
and bridge
).
The output folder contains:
- the resulting tileset file (with the .json extension)
- a
tiles
folder containing the associated set of.b3dm
files- The database and GML IDs of objects in the tileset are stored in the Batch Table of each
.b3dm
file
- The database and GML IDs of objects in the tileset are stored in the Batch Table of each
If you run th Tiler from WSL (Windows Subsystem for Linux) and encounter the error
psycopg2.OperationalError: connection to server at "localhost" (127.0.0.1), port 5432 failed: Connection refused
Is the server running on that host and accepting TCP/IP connections?
See How to connect to Windows postgres database from WSL, then find the WSL IP with
grep nameserver /etc/resolv.conf | awk '{print $2}'
Use this IP in your .yml config file.
By default, the tiler will treat the data as buildings. You can change the type by adding the flag --type
followed by one the 4 keywords:
building
citygml-tiler -i <path_to_file>/Config.yml --type building
relief
citygml-tiler -i <path_to_file>/Config.yml --type relief
water
citygml-tiler -i <path_to_file>/Config.yml --type water
bridge
citygml-tiler -i <path_to_file>/Config.yml --type bridge
By default, the tiler merges the surfaces of the same CityObject into one Feature
instance. When using the split_surfaces
flag, all surfaces will be an independent Feature
instance.
To keep the surfaces split:
citygml-tiler -i <path_to_file>/Config.yml --split_surfaces
The Batch table hierarchy is a Batch Table extension. This extension creates a link between the buildings and their surfaces.
To create the BatchTableHierarchy extension:
citygml-tiler -i <path_to_file>/Config.yml --with_BTH
When present, the --add_color
flag adds a single colored material to each feature. The color of the material is determined by CityGML objectclass
of each feature.
citygml-tiler -i <path_to_file>/Config.yml --add_color
If you want to apply different colors on the surfaces of buildings (roof, wall and floor), use the --split_surfaces
flag:
citygml-tiler -i <path_to_file>/Config.yml --add_color --split_surfaces
The default colors are defined by a JSON file. If you want to change the colors used, update the file with the right color codes. (See Color module for more details)
The flag --keep_ids
and --exclude_ids
allows to filter the CityObject(s). The flag must be followed by a list of CityGML IDs. See ID filter.
citygml-tiler -i <path_to_file>/Config.yml --keep_ids CityGML_ID_1 CityGML_ID_2
citygml-tiler -i <path_to_file>/Config.yml --exclude_ids CityGML_ID_1 CityGML_ID_2
The City Temporal Tiler creates tilesets with a temporal extension. This extension allows to visualize the evolution of buildings through time. For a detailed presentation of the input parameters and respective data formats, how that information gets transformed and represented within a resulting temporal 3DTiles, as well implementation notes refer to this TemporalTiler design notes.
In order to run the CityTemporalTiler you will first need to obtain the so called difference files between various temporal vintages. Let us assume such difference files were computed in between three time stamps (2009, 2012, 2015) and for two boroughs (LYON_1ER
and LYON_2EME
). Then the invocation of the CityTemporalTiler
goes from the home directory:
citygml-tiler-temporal \
-i py3dtilers/CityTiler/CityTilerDBConfig2009.yml \
py3dtilers/CityTiler/CityTilerDBConfig2012.yml \
py3dtilers/CityTiler/CityTilerDBConfig2015.yml \
--time_stamps 2009 2012 2015 \
--temporal_graph LYON_1ER_2009-2012/DifferencesAsGraph.json \
LYON_1ER_2012-2015/DifferencesAsGraph.json \
LYON_2EME_2009-2012/DifferencesAsGraph.json \
LYON_2EME_2012-2015/DifferencesAsGraph.json