Introduction: 3D Print an Earthquake

About: Doug McCune is an Oakland artist who embraces data exploration and map making in an attempt to come to terms with the chaos of urban environments. He experiments heavily with 3D printing and laser cutting to b…

It's easy to find data for the shake intensity of nearly every earthquake around the world, and this data is generated almost immediately after an earthquake hits. This walks through the steps to turn this data into a 3D print that represents the shaking intensity as a topographic map.

Step 1: Download a Shake Map From the USGS

The USGS uses a worldwide network of sensors to automatically produce shakemaps of all major earthquakes that occur throughout the world. Any large earthquake can be found in their archive of shakemaps.

You can find both historical earthquakes as well as scenarios. The scenarios are modeled hypothetical earthquakes that might occur as worst-case scenarios along major fault lines. For this tutorial we'll focus on a few major historical earthquakes.

This tutorial will map the Southern California Northridge earthquake of 1994. On the page for a specific earthquake you can find the shapefile downloads under Downloads > GIS File > Shape Files. The specific shapefile download that we'll use is here. Once downloaded, unzip that file.

The shapefile download of an earthquake contains multiple shapefiles that represent different measurements of shaking. PGA is peak ground acceleration, PGV is peak ground velocity, and MMI is Modified Mercalli Index. You can read about these various measurements. I'll be converting the PGV map to a 3D model, but the same steps apply for any of the other shapefiles in the archive.

Step 2: Understand the Data

I use QGIS to view shapefiles. If we open the PGV shapefile we can see the shake contours. What you're looking at is a contour map, very similar to a topographic map of elevation. But instead of representing the elevation these contour lines represent the shaking intensity of the quake. The map is made up of a series of polygons, and each polygon has associated attributes. The peak ground velocity is stored on each polygon as the VALUE attribute. If you color the shakemap by this value you can see how the shake intensity radiates out from the epicenter.

Step 3: Install NodeJS and Get Familiar With the Command Line/terminal

To convert the shapefile to a 3D model we're going to use a tool I wrote called shp2stl, which is a NodeJS library. To run shp2stl you'll need to download and install NodeJS. You can verify that Node is installed correctly by using the command line to type "node --version", which should output the version of Node that is running. On Mac OSX you can use Terminal to invoke node, and on Windows this guide walks you through using the Command Prompt.

Step 4: Setup Your Project Directory

Create a new file called quake.js, which will contain the JavaScript code you'll execute to convert the shapefile to a 3D model.

You're going to want the following files all within the same directory:

  • pgv.shp
  • pgv.dbf
  • quake.js

Use a terminal (either Terminal on a Mac or Command Prompt on Windows) and navigate to the project directory. Execute the following to download shp2stl and install it as a dependency:

npm install shp2stl

That should pull down shp2stl and create a folder called node_modules in your project folder.

Step 5: Setup Your JavaScript File to Use Shp2stl

Open the quake.js file that you created and edit it to contain the following text:

var fs = require('fs');
var shp2stl = require('shp2stl');

var file = 'pgv.shp';

shp2stl.shp2stl(file, { width: 100, height: 30, extrudeBy: "VALUE" }, function(err, stl) { fs.writeFileSync('quake_model.stl', stl); } );

This is the JavaScript code that will use the shp2stl library to convert the shapefile to the 3D STL file. The parameters in the above code specify how large (in mm) you want the model to be. In this case we are creating a model that is 100mm wide (about 4 inches) and 30mm high (a little over an inch). The extrudeBy parameter tells shp2stl which attribute of the shapefile to use to determine the height of the model. In this case the shake intensity is stored as a property called VALUE.

If you want to create a larger print just tweak the width and height parameters to suit your needs.

Attachments

Step 6: Run the Script to Generate the STL File

Now that you have everything setup you can run your code by typing

node quake.js

That will execute the program and you will end up with a new file called quake_model.stl in your project directory. You can view your model in something like MeshLab or by importing it into Blender.

Step 7: Print the Earthquake

Now the fun of 3D printing comes into play. Load the STL file up into whatever software you use for 3D printing (like Cura, Slic3r or Simplify3D) and get it sliced up into g-code to send to your printer.

You won't need any supports, since the topography is stacked straight up. The one caveat to printing maps like this with a large flat base: beware of the print lifting off the platform as it prints. PLA is typically a better material than ABS to ensure your print sticks to the build platform. A heated platform is recommended. I use the Type A Machines Series 1 Pro. And there are various tricks people use to keep prints sticking to the bed, like blue painter's tape or a film of glue from a glue stick (which is my preferred method).

Step 8: Bonus: Clip to Land

The shakemap doesn't distinguish between the land and ocean, so for areas along the coast, like this Northridge quake, it can be helpful to clip the shapefile to the land border to provide geographic context. You can use QGIS to clip the polygons.

First download a shapefile that represents the coastline. You can find highly detailed versions or simplified versions. Using a simplified version will allow the clipping operation to run fairly quickly, but won't give a highly accurate coastline. However, a detailed version might take a long time to perform the clipping.

The website thematicmapping.org contains some good simplified coastline shapefiles. The simplified world borders shapefile they have works well to give a general outline of the coast. Once you have downloaded that you can unzip it and load it into QGIS.

Once you have both the PGV shapefile and the simplified world borders shapefile loaded together in QGIS you can clip one using the other. Select Vector > Geoprocessing Tools > Clip. Then select the PGV shapefile as the input vector layer and the borders shapefile as the clip layer. Save the result as a new clipped shapefile and run that new one through the JavaScript program by modifying which shapefile the script loads.