Physical terrain models can be made with various technologies. 3D printing is a good choice for smaller models. For larger models we suggest stacking plates cut with a laser cutter or another tool. Milling is another option, but noisier and more dusty than 3D printing. Printed elevation models are useful in teaching, outreach activities, informal learning settings like museums, tourist offices, urban planning, etc.
This article describes how to create printable STL models with (mostly) free tools from various kinds of free terrain data (digital elevation models, DEM). Producing STL models from terrain data can be similar to producing models from 3D scans since some digital elevation models (DEMs) also use point clouds. This text is under construction and may need re-organizing. For the moment, I just take down notes of what I am playing with. So far, I identified several ways to create digital elevation models that work.
See also:
The outline of the workflow is the following (some tools allow combining steps, in some situations steps are done in different order or differently)
Too much for you ?
3D printing too slow ?
A digital elevation model (DEM) is a digital representation of a terrain surface that is created from elevation data. There are two kinds:
It is not clear (to us) whether radar models that measure the tips of trees and houses are DTMs or DSMs.
There are many formats used. Difference in horizontal resolution can be important. E.g. SwissALTI3D is only 2m meters, Eu-DEM is 25 meters, free SRTM data is between 30 and 90 meters. A resolution of 90 meters is fine enough for a larger area, e.g. 100x100km. Printing nicely smaller mountains requires 30 meter resolution. There exist errors for height (usually expressed in terms of mean errors).
Wikipedia has a good GIS file formats list that includes formats that can include DEM data. Acording to Wikipedia's Digital elevation model article, DEM can be represented as a raster (a grid of squares, also known as a heightmap when representing elevation) or as a vector-based triangular irregular network (TIN).
Below we just the list most of the the data types we played with and that appear in this article
Name | File extension | Description | Data type | |
---|---|---|---|---|
ESRI ASCII GRID | asc | A popular GIS specific exchange format. See Esri grid (wikipedia) | raster | |
geoTIFF | tif or tiff | Annotations to the 2D TIFF format. See GeoTIFF (Wikipedia) | raster (grid) | |
DXF | dxf | Autocad proprietary but many tools can import/export | vector | |
XYZ | xyz | Initially designed to describe molecule geometry. | vector (point clouds, each point has a x/y/z coordinate and there are no links between points) | |
SRTM HGT | hgt | SRTM original format | raster | |
DEM | dem | geospatial file format developed by the United States Geological Survey | raster | |
Collada | dae | 3D models used withing Keyhole Markup Language (KML), Google Earth | vector | |
GeoJSON | json | Popular exchange format for open source GIS packages | vector |
Most DEM data that is freely available on a world-wide basis has been collected by the NASA Shuttle Radar Topography Mission (SRTM) in 2000. It took 11 days to map out the Earth (except the seas and polar regions). Resolution of SRTM data is the following:
There are many other DEM data sets (primary or secondary) world-wide or on a national or local basis. Several of these data sets make use of the SRTM data set. A good list of available SRTM data sets is in the OpenStreetMap Wiki SRTM article.
Below are a few DEM repositories. Most of these require some "thinking" before you actually can get at the data.
Name | Resolution (x/y axis) | Mean errors (z)
depend on slope |
Data Source | |
CGIAR-CSI SRTM | 90m | Allows finding and exporting squares with 90 resolution for the whole earth. | ||
USGS EROS (US Geological survey) - EarthExplorer | 30 to 90m | Various, e.g. SRTM | The Earthexplorer allows finding map squares according to area and criteris, e.g. I found 30m resolution SRTM data for Geneva ara. Since the tiles cover small areas you may have to combine these. | |
ViewFinderPanoramas (VFP) | 30.92m | SRTM and ASTER GDEM | ||
EU-DEM | 30.92m | |||
EOWeb Poral (DE) | ||||
DHM25 | 25m | 2-8m | Swisstopo | Prior to SwissALTI3D, based in essence on the 1:25000 maps. This data set is free |
SwissALTI3D | 2m | Swisstopo | commercial dataset |
The TouchTerrain software [1], developed by Chris Harding and Franek Hasiuk (Iowa State University), is a very easy to use online service, also available as offline program, to create printable 3D STL models. It grabs DEM data from Earth Engine and turns them into STLs. It has a bunch of settings (simple and “expert”). It also allows printing multiple 3D models that can be glued together into a bigger model.
More information and official manual:
Use:
Re-center box in current map view
Export
The online version has seen a major update in Spring 2021 and includes a new GUI, place search with fly-to (very popular!), hover over (or click-toggle) help bubbles (the ?s), xml/kmz file import: digitize a polygon in google map (or whatever), save it as KML file and use it to outline the print area, “auto” z-scaling: set z-scale value to a height (say 20 mm tall) and the software will figure out a z-scale that makes your print 20 mm tall (excluding base height). Not yet tested- Daniel K. Schneider (talk) 10:27, 11 May 2021 (CEST)
As of May 2021, there is a docker image for running TouchTerrain standalone jupyter notebooks via a container. It needs a bit of setup and a somewhat beefy PC (or Mac or Linux box) but will install everything for you. If you haven’t tried the standalone (desktop) version, the author recommends using this dockerized version and the starter jupyter notebook.
Terrain2STL was in the past the the easiest and fastest way to get going and is alternative to Touch Terrain. Any beginner with a moderate amount of 3D mesh manipulation skills can do it.
Terrain2STL is an online service that allows selecting a square on Google maps. From these coordinates it then will extract a region from the Nasa/cgiar-csi data and produce the STL. Quote: “Terrain2STL is a free-to-use service, but if you want to help support the site, donations are welcome. Terrain2STL creates STL files using the SRTM3 dataset from 2000, which has a resolution of about 90 meters on the equator.” (Terrain2STL home page, feb 2017)
It only will need some cropping and a little STL repair, e.g. something that Netfabb Studio or other STL repair/slicer software can handle very well.
I tested this service and it works really well, e.g. I printed the Teide and Caldera Blanca volcanoes. The only caveat is the 90m resolution of the SRTM3 data set. The Caldera Blanca is a small 300m mountain on Lanzarote and did not come out in a very interesting way. The Teide (including its old huge caldera) created a fine enough model.
In case you want some more control, you can use the QGIS solution. If you own a Linux system, you also can use the hill program below which provides the same kind of results. While figuring out the coordinates and dimensions of your map takes more time, producing it is faster.
Finally, you should be aware that printing 3D models may require different slicer settings than the one you typically use. See below.
Hills is a command line package that can generate 3D models of areas in STL format of the earth's surface using SRTM 90m elevation data from CGIAR-CSI (see http://srtm.csi.cgiar.org/).
This command line tool is programmed in Haskel and requires some installation work. If you are not afraid of typing instructions, it's an easy to use tool. It can directly extract the right squares before doing the STL translation.
To install Haskel and cabal
sudo apt install cabal-install
To install hills:
cabal update cabal install hills
I found the program in ~/.cabal/bin/ so you might add this to your path:
export PATH=/home/_____/.cabal/bin:$PATH
This method works with the dataset and tools described below. I did manage to create fairly quickly a decent STL model of the Geneva basin area - Daniel K. Schneider (talk) 16:41, 3 March 2017 (CET)
Get a data file from CGIAR-CSI. The earth is divided into squares. Make sure to take the ESRI ASCII (*.ASC version !).
wget http://srtm.csi.cgiar.org/SRT-ZIP/SRTM_v41/SRTM_Data_ArcASCII/srtm_38_03.zip unzip srtm_36_01.zip
You now should have the following 150 GB file
150147952 Nov 24 2008 srtm_38_03.asc
From there you can extract rectangles that will be translated to STL models. You need the following information:
Get center coordinates
46.2044° N, 6.1432° E
Exactly what we need to extract terrain around Geneva. If you cannot retrieve this directly from google search, you could use google maps or google earth and then click on a point. E.g. my office building is around:
46.194644, 6.140955
Define rectangle size
Since any decent STL tool allows you to cut away slices, you do not need to be very precise. Better take 50% extra terrain.
Define elevation
Define scale
Example using the three parameters described just above. By default, hills will look at all the *.asc files that sit in the same directory.
hills --position 46.194,6.140 --dimensions 600x600 --base-altitude 300 --scale 1000 geneva.stl
generating for
46-6-36N 6-3-24E to 46-16-39N 6-13-24E 603 arcsec N/S x 600 arcsec E/W 18.618km N/S x 12.865km E/W
Here is the result as seen in Meshlab:
A second, better attempt that covered the whole was:
hills --position 46.194,6.140 --dimensions 1200x2400 --base-altitude 200 --scale 250 geneva-large.stl
The following will create a (roughly) 99 x 114 km area of the Geneva Lake - Mont Blanc area. Initially I extracted at base-altitude of 150m, but that was not low enough for such a large area.
hills --position 46.138,6.459 --dimensions 3200x5300 --base-altitude 0 --scale 600 geneve-mont-blanc.stl generating for 45-41-36N 5-43-21E to 46-34-57N 7-11-42E 3201 arcsec N/S x 5301 arcsec E/W 98.834km N/S x 113.781km E/W
For faster slicing and easier manipulation, you should reduce triangles, e.g. with Meshlab (see below)
AccuTrans is a cheap commercial DEM file manipulation program. It can important various DEM formats in various ways, create a 3D model and add a bottom and, finally, export to STL.
Initally, I tested the free 25m/200m resolution files from SwissTopo, i.e. fairly huge files. The dxf is 358 MB.
Extracting areas from these monster models can be challenging for some computers. You also could use one of few "educational models". E.g.Swiss topo provides two sample data (one is the model available as thing 26746.
I also use AccuTrans to process Collada (*.dae) files extracted from OpenStreetMap with Maperitive
The steps for converting dxf files are described in Relief für den 3D-Druck aus DHM oder DEM erstellen are the following:
(1) Load the model
(2) Make it a 3D model
Tools->Extrude Pseudo 2D surface
(2) Scale (this is optional)
Calculate scale
. Select the larger x or y value, then enter a desired result, e.g. 200 because your printer will want millimeters and your print bed is not much bigger than that. You always can fine tune in the STL editor.scale
buttonSet Min at 0.0.0
(3) Add a bottom
Tools->Extrude Pseudo 2D surface
Extrude
(4) Rotate the model (optional)
Adjust Object
icon90
button in the Rotate panel(5) Export as STL.
(6) Decimate triangles if your file is big
(6b, alternative)
(7) Repair and scale the file in an STL editor
The resulting file had about 440K triangles which is maybe reasonable. ... slice and print
(1) Open the file
ArcInfo ASCII Grid
, then select the file. Since *.asc also can refer to another format you will have to do it this way !(2) Make it a 3D model (maybe there is another way)
(3) Save as STL
(1) Open the XYZ file
... wait
(2) Convert to 2D structure
... to be continued.
Collada (*.dae) is used by Google earth and is used by Sketchup as exchange format.
Read OpenStreetMap, the chapter on Maperitive, 3D printing section.
The procedure is the same as for *.dxf files (+/- some little details).
This is described in Maperitive for laser cutting and 3D printing. The procure described takes more time and uses the same data, i.e. at some point in the prodecure you will retrieve the same type of STRM data and then pass the model to AccuTrans (see previous section).
Using OpenStreeMap is only a good option, if plan to "annotate" the 3D model with other information. E.g. print lakes, streets or boundaries with a another color (double print head required). You also can imagine to alter the geometry, e.g. extrude walls.
QGIS is a free GIS tool and its DEMto3D plugin allows to produce printable STL files. GDAL is a raster manipulation library that you could use standalone via command line instructions or through the "Raster" menu in QGIS.
We found this toolset to be both flexible and relatively easy to use. Recommended if you plan do create elevation models from a variety of data formats.
I do not know how well this works, since I focused on other solutions. See the QGIS/DEM23D plugin and the "hills" program above as alternative.
Installation under Ubuntu 16x
Requirements: The GDAL library and its Python bindings. Test if something is there:
ogrinfo
If not, see above (installation of GDAL)
Download the phstl.py script
git clone https://github.com/anoved/phstl.git
Copy the script to some place that is in the PATH,e .g. ~/bin or /usr/local/bin
Transforming a geoTIFF to STL
Get an example file, e.g. from CGIAR-CSI[2] that provide elevation models for the whole world.
You can select a square in an area of interest. However this will create huge files. Most of Sicily sits in a square that is represented by a 72 GB tiff file. Translated this produced a 565 GB (!) STL File, which will be very difficult to handle.
Transform the tif into a non printable STL with phstl.py
Example:
phstl.py srtm_39_05.tif sicily.stl
Since the STL was too huge I did not pursue this.
(not done yet since I somewhat failed, and then discovered the easy to use AccTrans program, see above)
Some interesting data is available in the form of point clouds, i.e. points defined by their x,y,z coordinates. E.g. 3D scanners produce this kind of output.
I tried creating a model from the free DHM25 Swiss topology office. The download link is at the bottom a provides a zip file that includes a huge dxf files, and two much smaller *.asc and *.xyz files.
Here is the procedure:
(1) Sample points
Filters -> Sampling -> Poisson-disk Sampling
View -> Open Layer dialog; If needed, highlight poisson-disk samples
(2) Compute normals for the point set. Menu:
Filters-> Point Set -> Compute Normals for point set
(3) Then build the surface
Filters -> Point Set -> Surface Reconstruction : Poisson
The result of the poisson disk sample looked ok (I could recognize a nice 3D model showing off the Alps, but the final result looked like a bunch of dragons cut into pieces ... The last step somehow went wrong.
Typical SRTM data sets include a rather high resolution, i.e. a 90 meters grid and models of a smaller area do have a manageable size. But if you plan to print 100 x 100km areas with mountains, I suggest reducing the amount of triangles a bit, unless you got really good hardware.
A good open source mesh manipulation tool is Meshlab, download and install it you don't already own it. If you already got an STL file, you also can use an STL editor, or Autodesk Meshmixer. The later can clean the inside of an object which sometimes is very handy.
Good mesh reduction is a fairly complex process since the algorithm should also preserve the shape. Be prepared to wait for many minutes or even hours if you got a slow machine. Therefore write down paramaters that work for you (wanted result, DEM file size, terrain structure, etc.)
Step 1
Menu File -> Import Mesh
Step 2
Step 3: Select the (maybe) best triangle reduction filter
Menu Filters -> Remeshing, simplification, and Reconstruction Quadric Edge Collapse Decimation
Now in the small popup
Then wait for a while. Verify the result. Sometimes a reduction can alter the overall geometry. The 25% reduced version of the Lake Geneva - Mont Blanc region still took a long time to slice.
MB | vertices (points) | faces (triangles) | |
---|---|---|---|
Before | 234MB | 2'343'502 | 4'680'670 |
Reduction to 20% | 46.8MB | 468'115 | 936'133 |
Reduction to 10% | 23.4MB | 234'195 | 468'299 |
I took 20 or 25% versions to slice. Of course one doesn't need that many triangles, but reducing too much may take out some mission critical features, like canyons or mountain tops close to each other. But I don't have any precise idea on that.
After that make sure to pass the mesh through a repair tool. Ideally you should that three times. Before reducing, after reducing and after adjusting the Z-height (I usually multiply by 2).
You also could Meshlab to repair the triangle structure (mesh), but I prefer using Netfabb since it does not require any understanding :)
Meshlab can be use in command line mode through the meshlabserver
program. It comes installed with Meshlab.
Usage:
meshlabserver arg1 arg2 ...
where args can be:
-i [filename...] mesh(s) that has to be loaded -o [filename...] mesh(s) where to write the result(s) -s filename script to be applied -d filename dump on a text file a list of all the filtering fucntion -l filename the log of the filters is ouput on a file -om options data to save in the output files
In other contexts, it is important to define what features should be saved. None of these are available for STL. It only includes triangles.
Generic example:
// cleanup with a script and save the same file format meshlabserver -i input.obj -o output.ply -s meshclean.mlx -om vc fq wn // simple file conversion meshlabserver -i input.obj -o output.stl
Mesh reduction and repair script example (the quadratic edge collabse is not ready yet)
meshlabserver -i input.stl -o output.stl -s clustering-decimation-script.mlx
E.g. the following would reduce a large STL terrain file with over 5'000'000 triangles. File clustering-decimation-script.mlx:
<!DOCTYPE FilterScript>
<FilterScript>
<filter name="Clustering decimation">
<Param type="RichAbsPerc" value="0.9649" min="0" name="Threshold" max="321.617"/>
<Param type="RichBool" value="false" name="Selected"/>
</filter>
<filter name="Remove Duplicate Faces"/>
<filter name="Remove Duplicated Vertex"/>
<filter name="Merge Close Vertices">
<Param type="RichAbsPerc" value="0.032162" min="0" name="Threshold" max="3.21617"/>
</filter>
<filter name="Remove Faces from Non Manifold Edges"/>
<filter name="Close Holes">
<Param type="RichInt" value="30" name="MaxHoleSize"/>
<Param type="RichBool" value="false" name="Selected"/>
<Param type="RichBool" value="true" name="NewFaceSelected"/>
<Param type="RichBool" value="true" name="SelfIntersection"/>
</filter>
</FilterScript>
3D Builder is a free mesh manipulation program from Microsoft that needs to be installed in windows 10
Mesh reduction can create bad meshes. Use the repair tool to fix that (or fix with another program). When I tested this program with a larger model from the Eiger area in Switzerland, I fixed the model, but according to Netfab Pro it still had mistakes and I used the latter to repair the model.
The same tool also can smooth. This can be useful if you plan to print steep mountains that won't hurt. However, use very little !
The meshmixer tool from Autodesk is somewhat easier to use, once you understand how to find the tool. It is not in the menu, since users are rather encouraged to reduce selected spots during mesh editing.
To reduce a whole terrain model, you must use shortcut keys (unless I did not understand something)
CTRL-A
(to select all). Wait until the object is orange! This can take minutes. Do not click on anything.SHIFT-R
(to launch the reduce tool). Wait (!!). You won't see any immediate feedback for this key stroke ! In addition, you may have to wait minutes before the reduce tool pops up. Ignore the popup to left that sits there by default.Accept
. This will compute the reduction for real and you will have to wait some time (minutes or hours depending on your model and machine)File -> Export
. You finally can export to binary *.STL format. Saving as Autodesk *.mix is a better idea if you plan to do other operations on the same output, e.g. add holes.Examples:
In addition to Mesh reduction, you also can make sure that nothing is inside the terrain model. To do so use the Edit/Make solid function. It also does mesh reduction and some smoothing. E.g. using the default values I reduced a 200MB model to a mere 6MB. However, if you want to keep the same outline, the model also can grow. See the next section.
You then also could insert hollow areas inside with Edit/Hollow. This should save printing time (but I did not test the latter so far)
This tool does two things. I will create a solid object with an empty interior from a "messy" model and it can do triangle reduction and smoothing of the surface.
As of Nov. 2017, the program crashed with a large file (757MB) using 0.1mm cells. It probably ran out of memory space since the target would have included more triangles and maybe produced a file of several gigabytes.
Therefore we suggest
The following settings did work on my laptop PC (DELL XPS 15 with a GTX 1050) with a 200MB STL model of Gran Canaria:
However the resulting file was a bit larger (250MB)) since it put triangles all over the flat sea and underneath the place. Interestingly, a 10MB model grew to 250MB since it created tiny triangles underneath the plate.
This tool will produce a second, new model. You can hide or remove the old model and then export the new model. Since the resulting model can be much larger than the input model I am not sure if we should suggest using this tool. Or maybe we a better understanding on how to use this.
Reduction with Meshmixer
Reduction with Meshlab
Both software seem to to do mesh reduction allright. Meshmixer seems to do a better job in smoothing than Meshlab. However it may not preserve terrain features as well (we just cannot tell).
Conclusion
Either tool can do. Both take their time. The Meshlab version is uglier, but that should not affect slicing. I find Meshlab much easier to use for mesh reduction. For other operations, the opposite is the case: Autocad's Meshmixer is much easier than Meshlab and it has good online documentation.
Below is the picture of a print. I used default settings of the Simplify3D slicer. Extrusion should be have been a bit fatter. Extrusion multiplier was set at 0.9, that is probably about 0.38mm. In simplify3D modify the Extrusion multiplier to 0.95, i.e. about 0.4mm or 1 = 0.42mm. For more fine grained result you could print 0.2mm layers or even less, but that would multiply printing time. Also, 1.5mm layers are more tricky to print (the risk of a nozzle being stuck or filament "drying" up is higher).
One corner was slightly bent. Getting the first layer right is really crucial. Clean your print bed and maybe add some sticky stuff, heat it more, etc.
Printing 3D terrain models can be very frustrating. I had 2 print aborts before I managed to print my first bigger than 10x10cm model. In order to reduce the amount of these inevitable failed prints, we suggest a few strategies for PLA or another polymer that does not warp. Note that print properties of various PLA are different. Adapt to your filament.
Make sure that the model is error free
First layer adherence and warping
Even PLA can and does warp when you print large surfaces.To increase platform adherence and reduce warping, use the following strategies:
Filling and extrusion width
One of the problems with 3D terrain models is that in some printed areas will exceed their expected height (too much extrusion used for flat areas). The print head then will "dig" into the plastic and if you have a second print head it may want to rip off the whole print from the platform. Therefore you will have to rethink the way to print.
Other tips
Reduce print time
Even a small object can take a long time to print. E.g. it took 10 hours to print a 13x17x1 cm model of the Geneva basin using 0.2mm layers and settings I designed for printing Lego blocks.
Printing upside down
(needs to be completed)
QGIS Tutorials (merging, repairing, etc.)