When showing people our products, we’re frequently asked, “so… how do you actually make your maps?” The short answer is that we process various digital map sources, enhancing and combining them to create 3D models that can be streamed over the web. The long answer is, inevitably, a bit more complicated than that. Let’s focus on a specific element of the 3D maps with 3D terrain (we’ll do a follow-up post on building at scale).
Our terrain at city-level is somewhat different to that of our competitors. While other companies focus on creating realistic, satellite imagery-based maps, we aim for a more fun, stylized approach. Our solution is also informed by the fact that our maps must run on low-end mobile devices. We rely on two main types of data when creating our terrain:
- Terrain Elevation
- Land Cover / Land Use
Elevation data is arguably the most important thing when creating 3D terrain. Without terrain elevation data, mountains and valleys are reduced to anonymous flatlands. It’s also important to retain these features, as local hills are important landmarks for navigation and orientation. Terrain elevation data is comes in various forms, but it’s mostly a raster heightmap format. One texel represents the elevation at a given point on the earth’s surface. In the image below, the whiter the value, the greater the elevation.
I’m going to generalize a little as the terminology is a little overloaded/inconsistent (hold your fire, GIS people!). There are three main types of terrain elevation data, and most of it is collected via remote-sensing satellites rather than direct survey.
Digital Elevation Models (DEMs) & Digital Surface Models (DSMs) typically contain samples that specify the elevation at which the first-reflected surface was encountered. This is problematic for use in terrain generation, as man-made structures (skyscrapers especially) will be struck first and can noticeably affect the results. If DEMs/DSMs are used unmodified in urban areas, buildings may sit atop artificial plateaus! Having said that, DEMs are often good enough(tm) and can be cleaned up to improve their accuracy.
Digital Terrain Models (DTMs) are typically derived from DEMs/DSMs, and processed to remove undesirable features like building elevation. DTMs contain the height of the natural terrain (i.e. the ground level) which is perfect for our purposes. The following picture shows the main difference between DTMs and other elevation models.
Land Cover / Land Use
It’s also important to know the classification of the land. This comes in two different flavors: Land Cover and Land Use. These are typically distributed as vector shapefiles. Land Cover pertains to the physical classification of the land (e.g. herbaceous rangeland), whereas Land Use relates to how people are using the land (e.g. residential, urban).
Here’s an example of some land use / land cover data from TIGER viewed in QGIS (an open-source GIS application). Each of the green polygons represents an area with a particular type of land use.
We run the land cover / land use data through an algorithm that assigns a simplified eeGeo terrain code (e.g., “forest”, “residential”, “exposed rock”). We have roughly 20 codes, so there’s plenty of variety. The terrain code drives the aesthetics of the terrain and determines the placement of trees & other decorations, too.
Putting it all together
Roughly speaking, the combination of data sources looks like this:
We retain a regular grid for the elevation data and ‘cut’ the land use polygons into the mesh (using interpolated elevations for the additional vertices). While this may seem slightly wasteful, it has an important property: providing we use the same elevation data source, the regular grid vertices and the planarity of the triangles will be consistent between builds. In future posts, we’ll expand on why this is a useful property.