Seeing the World with Data: 3D LiDAR with MapD and Uber’s deck.gl

GIS Contributor

Updated:

Dipti Kothari, an intern with MapD (update July 17, 2019: now known as OmniSci), has developed an open source project that uses LiDAR to create a 3D visualization of tree coverage around buildings and the impact of rising sea levels on buildings on Jekyll Island, GA.

LiDAR stands for Light Detection and Ranging, a surveying technique which scans a surface using laser light and returns a densely populated 3D point cloud. It lets you answer questions which were previously impractical or impossible to answer.

For example, you can calculate the precise tree coverage around every building on an island. Trees are natural windbreakers, lessening the damage caused by hurricanes. FEMA, might be using LiDAR to answer this question right now as they plan for the upcoming hurricane season.

In this blog post, we will be visualizing LiDAR in 3D with the assumption that the data is already processed and loaded into MapD.

LiDAR Data

The biggest challenge with visualizing LiDAR data is volume; LiDAR data from Netherlands alone has 640 billion points which easily scales to terabytes of data. Also, due to its widespread application in various domains from physical geography to drones and autonomous cars, the velocity at which this data is being generated knows no bounds.



Free weekly newsletter

Fill out your e-mail address to receive our newsletter!
Email:  

By entering your email address you agree to receive our newsletter and agree with our privacy policy.
You may unsubscribe at any time.



Presently, the most common way to use LiDAR data is via tiling, a time-consuming process. It would be great if we could just plugin LiDAR data and visualize it instantly, which is now possible using MapD and deck.gl.

Creating a Pointmap Using MapD and deck.gl

To create a pointmap in MapD Immerse ((update July 17, 2019: now known as OmniSci Immerse), we can use the X and Y coordinates from our LiDAR dataset. But the real essence of LiDAR data is in the 3rd dimension, the ability to visualize the Z axis.

To accomplish this, we will be linking MapD Connector (update July 17, 2019: now known as OmniSci Connector) with Deck.gl, Uber’s GPU-based rendering engine.

There are two design aspects that have been considered while building this application. Firstly, instead of plotting the entire LiDAR data on the map, I have limited the points to current bounding box. This is made possible by MapD’s blazing fast GPU-based SQL engine, which lets you query points within a given bounding box on the fly.

Secondly, within every bounding box I have limited the number of points to 50,000 and the sampling method used for this is Knuth Multiplicative Hashing.

Use Case: Modeling Storm Impact on Coastal Areas

After Hurricane Irma, it has become critical to understand the impact of trees in minimizing building damage during storms. For our example, we use LiDAR data from Jekyll Island, one of the barrier islands off the coast of Georgia, USA.  Microsoft Building Footprint data is used for the buildings (as polygons) on Jekyll Island, joined with parcels tax information from Glynn County to estimate building value. This data helps understand the impact of the rise in sea level on buildings, a valuable information for both city planners and insurance companies.

Variety in the data requires a fair amount of pre-processing, but for your convenience, I have provided pre-processed data ready to be loaded into MapD.

Let’s take a quick peek into the application itself:

Color Legend

Blue Points: Submersed Points

Green Points: Vegetation, i.e., Trees and shrubs

Light Brown Points: Surface, i.e., Rooftop and Ground

Brick Red Polygons: Buildings/Houses

Blue Polygons: Flood Level Indicator

Filters

Asset Loss: Displays the total property loss due to flooding (does not include land value)

Height Above Mean High High Water (MHHW): Slider lets you increase the sea level, reference datum is MHHW  

Number of Returns: An attribute specific to LiDAR data which helps in differentiating Surface from Vegetation
Point Radius: Size of Point

Building Type: Type of buildings on Jekyll Island

Ground Points: Displays only Ground Points

Surface Points: Displays Surface Points including Ground Points

Vegetation Points: Displays only Vegetation

High Precision: This switch is activated at the highest zoom level and when turned on it displays 500,000 points.

Freeze Screen: Locks the current display, after which no more requests are sent and the user can pan/zoom using the same points

Visualizing tree coverage around a building on Jekyll Island

There are three factors which are worth considering during a storm, i.e., tree coverage, tree height, and distance of tree from the building.

Tree coverage around a building helps in mitigating the damage caused by incoming heavy winds, as the wind now hits the tree rather than the building. Height of the tree is useful in estimating how far away from the house can the treetops bounce the wind. It’s also worthwhile to know how far away is the house from the tree in the case that the tree falls down.

A row of trees serves as a windbreak, slowing down wind, in the Furnace Creek area, California.  Photo: USGS, public domain.
A row of trees serves as a windbreak, slowing down wind, in the Furnace Creek area, Death Valley, California. Photo: USGS, public domain.

To visualize these three factors using the application, I have increased the point radius to 11px and freezed the screen. As seen below, we can visualize tree coverage, height of the trees and also the distance of the trees from the building.  

Visualizing flood water rise and asset loss

At Jekyll Island, the rising sea level due to global warming and during storms has become a rather pressing matter as it sits right on the ocean. Using this application, one can stimulate the impact of rise in sea Level from 0 – 6 feet above MHHW on buildings and also asses the loss in property. To do so, I have switched off Ground, Surface and Vegetation Points.

Visualizing the shape and height of dunes around Jekyll Coast

Dunes are very useful for Jekyll Island in its fight against rising sea level. This application lets you visualize dunes by switching off Vegetation Points. When turned on, the vegetation cover over the dunes can be analyzed, which would be helpful in finding dune patches prone to soil erosion.

Code Implementation

I begin with establishing a connection with MapD server using MapD Connector to access MapD’s SQL engine. Once the connection is established, I query the database for points and polygons within the current bounding box, i.e., poly in the below queries:

Query for LiDar Data:

var rows_passing_filters="(SELECT COUNT(rowid) FROM jekyll_points WHERE ST_Contains(ST_GeomFromText('POLYGON(("+poly[0][0]+" "+poly[0][1]+","+poly[1][0]+" "+poly[1][1]+","+poly[2][0]+" "+poly[2][1]+","+poly[3][0]+" "+poly[3][1]+"))’), point) "+filterPoints+")";

var pointQuery="SELECT X,Y,Z, HeightAboveGround,NumberofReturns,Classification,rowid FROM jekyll_points WHERE MOD(jekyll_point.rowid * 2654435761, 4294967296) < "+"((50000*4294967296)/"+rows_passing_filters+") AND ST_Contains(ST_GeomFromText('POLYGON(("+poly[0][0]+" "+poly[0][1]+","+poly[1][0]+" "+poly[1][1]+","+poly[2][0]+" "+poly[2][1]+","+poly[3][0]+" "+poly[3][1]+"))’),point) "+filterPoints+" LIMIT 50000";

Query for Polygon Data:

var queryIntersect = “SELECT DISTINCT(FID_1) FROM jekyll_polygonEdges WHERE ST_Contains(ST_GeomFromText('POLYGON(("+poly[0][0]+” ” + poly[0][1] + ",” + poly[1][0] + " ” + poly[1][1] + ",” + poly[2][0] + " "+poly[2][1]+","+poly[3][0]+" "+poly[3][1]+"))'),mapd_geo)”

var polyQuery = "SELECT mapd_geo,avg_z,avg_ground,BLDGVAL17 FROM jekyll_polygons WHERE SHAPE_area<12291479 AND FID_1 IN (“+ queryIntersect +”) "+filterPoly;

Using the query results I created three layers, one point cloud layer and two polygon layers using deck.gl. Finally, every time the bounding box is modified, the layers are updated with the new data.

The application is open source and can be downloaded and setup locally.

Code Repository: https://github.com/mapd/lidar-visualization

About the Author

Dipti Kothari is an intern with MapD who is completing her Master in Computer Science at University of Southern California.

Photo of author
About the author
GIS Contributor
Guest articles from GIS professionals. Authorship information is listed at the bottom of the articles.