Open 3D urban data – CityGML

tl;dr I made a map of the buildings contained in Rotterdam’s 3D open urban data model.

Open Urban Data
The recent Dutch push for open data lead by Hack de Overheid (HdO) has brought many interesting data sets out in the open. Over the last couple of years HdO successfully promoted the open data idea in The Netherlands. They organised many hackathons at cool locations (always with top-notch coffee!) and app contests in order to educate the public, hackers and governmental organizations on the topic of open data.

Hack de Overheid’s activites have moved governmental, provincial and municipal organizations to open their data stores to the public. The main source for Dutch data is data.overheid.nl. The Dutch portal for (open) geographical data is nationaalgeoregister.nl. Alongside these centralised data sources, several cities have set up their own data portals. Current urban data providers include The Hague, Eindhoven, Enschede and Rotterdam. The available data ranges from trivial things like news feeds to more interesting information like energy consumption per city district. The dataset I’m most excited about is the 3D city model of Rotterdam.
A 3D city model is a digital representation of the urban environment, a three-dimensional map that contains common city objects such as buildings, roads, trees, etc. A well-known city model format is Google’s KML (Keyhole Markup Language) that can be loaded in Google Earth. It is the data format in which buildings generated with Google’s SketchUp or Buildingmaker are made.

CityGML – 3D urban data model
The Rotterdam 3D city model comes in the more powerful CityGML format. CityGML is a rich information model that stores 3D urban objects ranging from lamp posts and dustbins, to buildings and trees. Objects are stored as geometries that have semantic and thematic properties which serve as links in the formation of object aggregates. In other words, the type and properties of every stored are known, and every object is made of other objects that also have a known type and properties. For instance, an object of type house is stored as a collection of one or more objects of type window, wall, door, etc. These semantic and thematic links allows us to retrieve “all walls of a building that are made of brick.” Such a query is not possible in KML as it does not have knowledge of what each geometry represents. CityGML has many more strengths including predefined levels of detail, implicit geometries, prototypical objects, transportation classes, scene graph concepts, etc. that make it a powerful and complete data model for capturing all entities in a city.

All this power comes at a cost: CityGML is complicated. It’s XML/GML file-based nature doesn’t lend itself to experimenting and hacking. The underlying data model is vast. Curious developers must be ready to invest some time in getting to know it. Some of the burden is alleviated by pushing the data to a spatial relational database. The available tools perform this task well. However, currently the data can only be pushed to Oracle Spatial, a powerful but expensive commercial database.

Dutch Standard
CityGML is an interesting information model that is worth investing time in as it is becoming the de facto standard for storing and managing urban geographical information. It is well received and widely adopted in Germany and became an official standard for 3D data in the Netherlands in June of 2011. The second phase of a Dutch 3D pilot project is conducted which seeks to bring urban 3D data producers, consumers and academia together to explore the practical implementations and applications of CityGML.

Interesting things are bound to happen once CityGML is freed from its confines and falls in the right hands. The 3D Pilot website (in Dutch) showcases several large-scale uses of the Rotterdam 3D model. Some simpler smaller-scale ideas include:

  • – calculate shadows cast by buildings and determine whether your favorite pub has its terrace out in the sun.
  • – use 3D facade information to correctly fit augmented reality objects to real-world buildings.

Opening up the data
I’ve therefore started a project on github that aims to make working with CityGML easier. The idea is to make exploring and browsing CityGML models on the web by way of a WebGL viewer (using SceneJS). At the same time I want to develop a simple API that gives quick access to the geometries and attributes of single buildings and arbitrary city regions.

The app itself lives here. It currently displays clickable building footprints of several districts in Rotterdam.

It seems that CityGML is here to stay. Let’s make it feel right at home and use it to develop some great apps.



2 views shared on this article. Join in...

  1. sri says:

    very interesting, but you say freeing them. But I find it more locked, is there access to your data ? I am looking for building heights of rotterdam buildings. how can i get them ?

    • Simeon says:

      Hi,

      the 3D model of Rotterdam is open, you can find it in their open data store.

      CityGML is a semantically rich data model: buildings are made of footprints, walls and roofs. To extract the building heights you need to find the geometries that represent roofs. In the XML file these are stored in a building’s bldg:RoofSurface element. Roof surfaces are formed by one or more gml:Polygon which in turn are defined by a gml:LinearRing. The coordinates are stored in a gml:PosList as 3-tuples separated by spaces i.e. x1 y1 z1 x2 y2 z2 … You can thus retrieve a building’s height by extracting all z coordinates and e.g. averaging them, picking the largest, etc.
      See this gist for an example RoofSurface definition.

      A more robust way of dealing with CityGML models is to import them in a spatial database and query them with SQL. The 3D City DB project maintains importers that import .gml files into Oracle and PostGIS thereby keeping the semantics intact.

      Out of curiosity: what are you planning to do with the heights?

Leave a Reply

extra smooth footnotes