3D printing of digital elevation models

The educational technology and digital learning wiki
Revision as of 14:01, 3 March 2017 by Daniel K. Schneider (talk | contribs) (Created page with "== Printing elevation models == The outline of the workflow is the following: # Get a model # Translate it to STL (this may need passing through an intermediary format) # Ma...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Printing elevation models

The outline of the workflow is the following:

  1. Get a model
  2. Translate it to STL (this may need passing through an intermediary format)
  3. Make the model manyfolded with a flat bottom
  4. Slice and print it

Creating STL from elevation maps with gdal and phstl.py

Installation under Ubuntu 16x

Install the gdal library

sudo apt-get install libgdal-dev
sudo apt-get install gdal-bin

Test if something is there:

ogrinfo

Install the python interface (?)

sudo apt-get install python-gdal

Install the gdal python library

sudo easy_install 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[1] 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. Maybe cropping the tif file before translating could be a solution, but which program can do it without deleting the height information data ?

Using Terrain2STL oneline service to produce STL

Terrain2STL is an online service that allows selecting a square on Google maps. From the 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 repair, e.g. something that Netfabb Studio 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 the old huge caldera) created a fine enough model.

Using Hills to procude STL from SRTM data

Hills is another package that can generate 3D models of areas in STL format of the earth's surface using SRTM 90m elevation data from CGIAR-CSI w(see http://srtm.csi.cgiar.org/).

This command line tool is programmed in Haskel and requires some installation. It's advantage with respect to phstl.py is that it can directly extract the right squares before doing the STL translation.

Installation under Ubuntu

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:

  • Edit ~/.bashrc
  • Prepend /home/your_login/.cabal/bin to :$PATH, e.g.
export PATH=/home/_____/.cabal/bin:$PATH

Using hills

Get a data file from CGIAR-CSI. The earth is divided into squares.

SRTM Data Search allows to identify squares that you then can dowload
  • Either use the website where you can select the squares (see figure above)
  • Or write down the square number and change the URL below. 38_03 represents parts of Western Switzerland, French Haut-Savoie etc. (are where University of Geneva is located)
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

  • Coordinates of the center, defined as decimal latitudes and longitudes. North of the equator is positive, south is negative. East from Greenwich is positive, west is negative. A good trick is to ask Google. E.g. longitude Geneva gives:
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 building is around:

46.194644, 6.140955

Define rectangle size

  • Hill requires an area in arcseconds, latitude first. Default values are 300x600. An arcsecond is 1/3600 of a degree and roughly represents 30 meters (it depends where you are). Therefore:
1km = 33

10km = 330

Since any decent STL tool allows you to cut way slides, you do not need to be very precise. Better take 50% extra terrain.

Define elevation

  • By default, the model will start a sea level. Again you easily could cut this way. But you may consider giving a height. Again, you simply can ask goole, e.g. elevation geneva. Add enough height to cover the lowest point.

Example using the three paramaters. 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:

Geneva terrain model made with [ hills] and [ SRTM data

Bibliography, links and footnotes

  1. Quote: "The CGIAR is a global partnership dedicated to reducing rural poverty, increasing food security, improving human health and nutrition, and ensuring more sustainable management of natural resources. The Consortium for Spatial Information, CSI, is the CGIAR community of geo-spatial scientists that promotes and practices the application of spatial science to achieving these goals most effectively." http://www.cgiar-csi.org/ Feb 2017