Sun and Shadow Maps: Models vs Reality

During the Mapbox BUILD conference this week, something was said that gave me clarity on my vision for sun and shadow simulation. The speaker gave a demo of Mapbox GL JS v3 which includes 3D tree renderings. The speaker said that the trees were not accurate depictions because the purpose of maps is to convey information and not depict reality. The maps purpose is to let you know trees are there without specifying their height or type (oak, pine, cedar, birch, etc). Maps simplify how we represent the real world.

Rendering of trees in London in Mapbox GL JS v3

In the same sense shademap.app has been nothing more than a model of sun and shadow, more akin to a fancier version of suncalc. It models where the shadows will fall but it does not reflect reality. The reason is because the map is constructed from models. It uses an elevation model and building models.

Lets start with the elevation model. The elevation model is gathered from space using radar topography. This data covers the entire planet but in some areas measurements are only gathered every 30 meters. How do we know the elevations between the sample points? We model them using a best guess, often drawing a straight line between the two points. But there are many cases where this does not model reality.

Shadow simulation using models

Models often simplify reality

Next are the building models. The building footprints are estimated from satellite images and most of the building heights come from volunteers of OpenStreetMap who walk around and record the number of stories. Buildings not surveyed by volunteers are just assumed to be single story. How tall is a single story? We have a model for that. We assume it’s 3 meters or about 10 feet. In reality, the height of a story varies building to building. Then there is the roof shape. Once again we model most buildings with a flat roof which is inaccurate for many houses around the world.

Each time we use a model to represent reality we lose accuracy. When shademap.app calculates shadows and hours of sunlight for a location on the map, it’s really just an estimate. Treat it as a model of reality but not the truth.

I like to think of models vs. reality in terms of maps versus aerial photos. A map shows you where a road, house or river is but it can’t tell you exactly how wide that river is at point x, if a house has a steel or tile roof or if a road has large potholes. That’s not it’s job and a map would be overwhelming if it tried to convey all this data. Aerial photos, on the other hand, can answer all of the above questions with a glance.

Can shadows be realistic? #

Yes. We now have data on exact heights of terrain, buildings and trees thanks to LiDAR (Light Detection and Ranging). This technology determines the height of surfaces on the ground by measuring the time it takes light emitted from a plane to bounce off the ground and return to the aircraft. An aircraft can takes thousands of these measurements a second, with each sample less than half a meter (1.5 feet apart). It’s similar to a laser distance measure you can buy at your local hardware store. Trees, buildings, towers and fences are all captured in these surveys and their positions and heights are accurate to within inches.

Shade modeled using map data

Shade modeled using elevation + building models. Useful?

In sun and shadow simulation LiDAR data (or what I currently call “Tree Data” on shademap.app) is the much more realistic model akin to aerial photos. LiDAR data can be used to model shadows far more accurately than previous elevation and building models. It can be used to accurately answer questions such as: “how much direct sunlight can I expect in this location” and “will this spot be in the shade at 4pm”.

Shade modeled using LiDAR

Same location modeled with LiDAR. Trees!

This is why I will be focusing much of my attention on sourcing LiDAR data for more regions of the world and conveying their value to ShadeMap users. I don’t see the point of building more features for analyzing sun/shadow based on the currently inadequate elevation and building models. It conveys a false truth.

The future #

I think Google has this market cornered at the moment. They have amassed and processed a mass trove of LiDAR data (A reader pointed out that photogrammetry may be the source of this data as well). You can see this when you tilt a Google Map in satellite view and trees and buildings rise up in three dimensions. These 3D models are now available to developers via a standard called 3D Tiles.

Google’s 3D tiles. Wow!

Mapbox GL JS v3, on the other hand, is about to release realistic lighting with shadow casting for their map models. It is also, in theory, capable of loading 3D Tiles. This hints at the fact that world-wide sun and shadow simulation is about to be commoditized. Any developer will be able to build a more realistic version of shademap.app in a day if they are willing to stomach the cost of paying for Google’s and Mapbox’s API fees. The moat is gone.

I’m not sure what position this leaves me in. ShadeMap was just a hobby project I’ve been trying to build into a business for a few years. The technology offerings on the horizon can make ShadeMap infinitely better but at a very high cost (fees to Google and Mapbox) that will make it prohibitive to host for free and I’m not sure there’s a large market of people that are willing to pay this premium. There’s also the possibility that if the demand is there, Google or Mapbox can add this feature to their own offerings, since it will be a trivial investment on their part.

Anyways, I just wanted to get these thoughts down as I’ve been thinking about this since yesterday. I still plan to work on ShadeMap full time for the present as it has be an incredible learning opportunity. I enjoy using maps and I hope to use my new found knowledge to build more projects centered around my personal pursuits in the outdoors.

 
13
Kudos
 
13
Kudos

Now read this

Browsing on a Chromebook using a SOCKS proxy

How to watch HBOGO abroad on your Chromebook? Turn on developer mode on your Chromebook Press Ctrl+Alt+T to open a shell window and type shell at the prompt Start a SOCKS proxy server on your laptop that forwards traffic through a server... Continue →