Working with 3DCityDB Series
Importing CityGML into 3DCityDB with PostgreSQL
In the previous part, we successfully set up an empty 3DCityDB schema inside PostgreSQL with PostGIS. At this stage, the database structure exists — but it’s still empty.
In this part, we’ll bring the city to life.
We’ll use the 3DCityDB Importer/Exporter Tool to import a real CityGML dataset (Berlin LoD2 buildings) into our database and verify that everything has been stored correctly.
By the end of this section, you’ll know:
If you want to understand how to install the required software for 3DCityDB, please follow Part 2 of this series.
Let’s begin importing 3D cityGML data….
Start by opening the Importer/Exporter Tool:



Once the tool opens, you’ll see a multi-tab interface. Everything related to database connectivity happens in the Database tab — that’s where we start.
Click on the Database tab. This is where you tell the tool how to reach your PostgreSQL + 3DCityDB instance.

Fill in the connection details as follows:
Once all fields are filled, click Connect.
If everything is correct, connection details and status messages will appear in the console panel on the right. If something goes wrong, error messages will be printed there, which makes troubleshooting much easier.

Before importing anything, we always validate the CityGML file.
Why this matters: CityGML files are complex XML documents. Even small structural errors can cause:
Validation helps catch these issues early.

2. Click on Browse and navigate to the tutorial dataset folder:
C:\RTG_Schulungskurs_2016\CityGML-Data\


Select file —
Berlin_CityGML_Lod2.gml


3. Click Just validate
The tool will now check the CityGML file against the official CityGML XML schema. When validation completes:
👉 Best practice:
Only import CityGML files that pass validation successfully. Importing invalid data often causes problems later during export, visualization, or querying.
Once validation succeeds, you’re ready to import. You may notice several optional filters in the Import tab:
For this tutorial:
Now click Import.
A progress window will appear showing:
You can cancel the import at any time, but for this dataset, it usually completes within a few minutes.

After the import finishes, a summary appears in the console showing:
This summary confirms that the CityGML data is now stored inside your 3DCityDB schema.

At this point, your database is no longer empty — it contains a real 3D city model.
To double-check what’s inside the database:
You’ll see a list of all 3DCityDB tables along with row counts — a great way to confirm that buildings, surfaces, and related objects were stored correctly.

Next, we’ll compute the spatial extent of the imported city model.
The tool will automatically compute:
These coordinates define the geographic footprint of the city model and will be used later for:

You can copy these values directly using the copy options provided.

You can copy the coordinate values to the clipboard by clicking the button or by right-clicking on a coordinate value field and choosing the Copy bounding box option from the context menu.
At this point, you have:
This is a major milestone.
Your city is now stored semantically, spatially, and structurally inside a real 3D city database.
In this tutorial series, we’re using a Berlin LoD2 CityGML dataset. However, Berlin is just one example.
If you’re curious to experiment with other cities, countries, or even global-scale models, there is an outstanding community-driven resource you should know about.
The “Awesome CityGML” GitHub repository curates one of the most comprehensive collections of open, semantic 3D city models available today. It brings together datasets published by universities, national mapping agencies, and city authorities around the world.
According to the latest update, the repository includes:
This means once you understand the workflow with Berlin, you can reuse the same steps to import:
If you’d like to try importing a different city or region, you can browse and download datasets from the Awesome CityGML repository on GitHub.
GitHub - OloOcki/awesome-citygml: The ultimate list of open data semantic 3D city models
The authors also request that if you use the repository in academic or professional work, you cite their paper and the Zenodo DOI, as it represents a significant community effort.
In the next steps, we’ll continue working with Berlin — but everything you learn here applies equally to any CityGML dataset you choose to explore.
So far in this tutorial, we’ve used the Importer/Exporter graphical interface, which is the easiest and most intuitive way to work with CityGML — especially when you’re just getting started.
However, it’s worth knowing that 3DCityDB also supports a full Command-Line Interface (CLI).
This means you can run imports, exports, validation, and cleanup operations directly from the terminal, without opening the GUI. The CLI becomes extremely useful when:
When you install the Importer/Exporter tool, it also installs a small executable called impexp.
Depending on your operating system:
This executable lives inside the bin folder of the Importer/Exporter installation and allows you to run commands such as:
All of these actions can be triggered using simple terminal commands.
The CLI is very powerful and comes with many options (logging, plugins, memory tuning, batch arguments). To keep this series beginner-friendly, we won’t dive deep into CLI syntax here.
If you’re interested in automation or server-side workflows, the official 3DCityDB documentation has a dedicated section on CLI usage — and we may cover a hands-on CLI example in a later advanced post.
4.9. Using the command-line interface (CLI) - 3dcitydb-docs 2024.0.1 documentation
In the next part of the series, we’ll start exporting data:
This is where your city model becomes truly visual and interactive.
If you’re following along, feel free to:
💬 drop questions/feedback in the comments
⭐ follow the series for upcoming parts
🔔 Subscribe for email updates on 3DCityDB workflows
See you in Part 5 — where your city leaves the database and enters the real world 🌍🏙️