City Geography Markup Language (CityGML) is an open data model and XML-based format for storing and exchanging 3D city and landscape models. It exists so that buildings, terrain, roads, vegetation, water bodies and city furniture can be described once in a shared schema and then read by different software, rather than each planning office keeping its own private format.
If you typed the phrase into a search engine, you are probably deciding whether CityGML is the right format for a project, or trying to open a file that ends in .gml and wondering what is inside it. The short version: it is a standard, not an app, and you will need software that understands the schema to see anything useful.
What CityGML Actually Stores, Feature by Feature
CityGML organizes a city into a small set of top-level feature types. The core ones are Building, Bridge, Tunnel, Road, Railway, WaterBody, Vegetation, CityFurniture, LandUse, Relief (the terrain surface), Transportation and GenericCityObject. Each feature can carry geometry, semantics and attributes such as a function, a usage, a year of construction or an address.
The semantics are the point. A plain 3D mesh only tells you where surfaces are. CityGML also records that a particular wall is a wall, that a window belongs to a specific building, and that a roof surface faces a certain way. That is what lets a solar-potential study, a noise map or a flood simulation use the same dataset without re-modelling the city each time.
Geometry is stored in a separate module called GML, the Geography Markup Language from the Open Geospatial Consortium. CityGML builds on GML, so a CityGML file is valid GML with city-specific elements layered on top. Coordinates are usually in a projected coordinate reference system, and the file declares which one, which matters because a model in one national grid will not line up with data in another until you reproject it.
The Five Levels of Detail and What Each One Is For
CityGML defines levels of detail, usually abbreviated LOD, and this is the concept most people need to understand before choosing data. The levels run from LOD0 to LOD4, and each one answers a different question.
LOD0 and LOD1: Terrain and Blocks
LOD0 is the terrain surface, often a digital elevation model with no buildings on it. LOD1 is the extruded block model: each building is a simple prism with a flat roof, no windows and no roof shape. LOD1 is cheap to produce and fine for rough volume calculations, citywide shading studies and visualization where individual facades do not matter.
LOD2 and LOD3: Roof Shapes and Openings
LOD2 adds differentiated roof shapes and, optionally, thematic surfaces such as walls and roofs separated as distinct objects. LOD3 adds openings: doors, windows and balconies as real geometry, plus more detailed roof structures. LOD3 is the level most energy simulations and facade analyses need, because window area and orientation drive the results.
LOD4: Interiors
LOD4 adds interior structure: rooms, doors between rooms and interior furniture. Very few citywide datasets reach LOD4; it is used for individual buildings where indoor navigation, emergency evacuation modelling or detailed energy work is the goal.
A rule of thumb worth remembering: pick the lowest LOD that answers your question, because file size and processing time climb steeply as detail rises. A citywide LOD1 model can be a few hundred megabytes; the same extent at LOD3 can run into many gigabytes.
How CityGML Files Are Structured and Read
A CityGML dataset is usually delivered as one or more XML files, often compressed, sometimes split by tile or by feature type. Inside, you will find a header declaring the schema version and the coordinate reference system, then a series of city object elements. Related objects are linked by identifiers rather than nested inside each other, so a building and its address can sit in different files and still connect.
Because it is XML, you can open a CityGML file in a text editor and read it, but the geometry will be long lists of coordinate tuples that are hard to interpret by eye. For actual work, use software that imports CityGML directly. Desktop GIS applications with 3D capability, 3D modelling tools with CityGML importers, and dedicated city-model viewers are the usual routes. Menu labels differ between applications and versions, so look for an import or open dialog that lists CityGML or GML as a supported format rather than expecting an identical path everywhere.
If an import fails, check three things in order: that the file is not still compressed, that the coordinate reference system is declared and supported by your software, and that the schema version of the file matches what the importer expects. Version mismatches between CityGML releases are a common cause of a file that opens but shows nothing.
CityGML, CityJSON and IFC: Which Format Fits
CityGML is not the only option, and knowing the alternatives saves time. CityJSON is a JSON-based encoding of the same CityGML data model. It carries the same features and levels of detail but is more compact and easier to handle in web and scripting contexts. If your team works in JavaScript or Python and does not need XML tooling, CityJSON is often the smoother choice, and conversion between the two is well supported.
IFC, the building information modelling format, operates at the scale of a single building with construction-level detail. CityGML operates at the scale of a city or district. The two are complementary: IFC models can feed the detailed end of a CityGML dataset, while CityGML provides the surrounding context. A common misconception is that CityGML is a replacement for BIM; it is not, and trying to force a whole city into a BIM workflow or a single building into a city model usually produces clumsy results.
For a district energy study, the practical decision rule is: use CityGML or CityJSON for the urban context and building envelopes, and pull IFC only for the handful of buildings where you need construction detail.
Where to Get City Models and How to Check Them
Many national mapping agencies and city governments publish CityGML datasets as open data, often at LOD1 or LOD2 for whole cities. Availability, licensing and coverage vary by country and by municipality, so check the publisher's own data portal for the current terms rather than assuming a dataset exists for your area.
When you receive a model, validate it before building anything on top. Check that the coordinate reference system matches your other layers, that buildings sit on the terrain rather than floating above or sinking into it, and that the level of detail is what the metadata claims. A quick visual check in a 3D viewer catches most problems in minutes. Also confirm whether the dataset includes terrain at all; some building-only deliveries will leave your model hovering in space until you add a relief surface.
Store the original files unchanged and work from a copy. CityGML datasets are large, and a corrupted edit is expensive to undo.