Generate STL models from SRTM elevation data.
This program generates 3D models of areas of the earth's surface.
It uses the SRTM 90m elevation data from CGIAR-CSI which is downloadable free of charge (see http://srtm.csi.cgiar.org/). It outputs STL.
Consult README.md for full instructions.
hills
A program to generate 3D models of places on the Earth's surface.
It uses as input the SRTM 90m elevation data from CGIAR-CSI, which is downloadable free of charge from http://srtm.csi.cgiar.org. It outputs binary STL.
In spite of its name the program also works on valleys.
-- David Fletcher [email protected]
Basic use
Pick a latitude and longitude. (Google Maps will show it when you click on a point.)
Run hills. It won't work because we don't have the input data yet, but it will tell us which tiles we need.
hills --position 56.64,-4.91 out.stl
Obtain the input data tiles from CGIAR-CSI http://srtm.csi.cgiar.org/srtmdata/ or a mirror.
You want 5x5 degree tiles in the ASCII format. The download interface on the website is better than it used to be but it still might be quicker just to construct URLs directly like
wget http://srtm.csi.cgiar.org/wp-content/uploads/files/srtm_5x5/ascii/srtm_36_01.zip
Unzip the downloaded file and you should obtain a file named srtm_36_01.asc.
Run hills to generate a model.
hills --position 56.64,-4.91 out.stl
Look at the output in your favourite STL viewer.
Options
--position LAT,LONG
-p LAT,LONG
Latitude and longitude as decimals. North of the equator is positive, south is negative. East from Greenwich is positive, west is negative.
Usually the centre of the area to be modelled (but see --offset).
--dimensions ARCSECxARCSEC
-d ARCSECxARCSEC
Size of the area to model in arcseconds, latitude first. Defaults to 300x600.
Remember as you go further north or south from the equator, arcseconds of longitude get smaller.
--base-altitude METRES
-b METRES
The bottom of the volume to be modelled. Defaults to 0m (sea level). If you are modelling land on a plateau or massif you may want to set this higher so that your model won't be on such a thick base. If you are modelling land that goes below sea level you'll need to use a negative value to put the base low enough.
--scale FACTOR
-s FACTOR
Defaults to 100, meaning 1:100. This might seem like a larger scale than anyone would want, but note that the program outputs in metres whereas 3D printers commonly expect millimetres, so you might already be getting a factor of 1000 on top of what you specify here.
--input-dir DIR
-i DIR
If you have your .asc files somewhere other than the current directory, point to them with this option.
--offset ARCSECxARCSEC
-o ARCSECxARCSEC
In arcseconds, latitude first. Offset from the specified position to the southwest corner of the area. By default the position is the centre of the area. So if you'd rather specify the southwest corner you can use an offset of 0x0.
However, the main reason for this option is to generate multi-part models without having to change the reference position. This is convenient because the dimensions are in arcseconds so it's easier to do your local positioning in arcseconds too. It's also more accurate, because the program calculates the number of metres per arcsecond at the specified position, and if you change the position between two of the parts their scales may not match perfectly.
Caveats and bugs
The SRTM data doesn't go north or south of 60 degrees, so this program can't help you in those areas.
The program doesn't yet do any interpolation between the input samples. So the position you supply is rounded to the nearest input sample position, and dimensions that are not multiples of three arcseconds are expanded so that the edges are on 3-arcsecond boundaries. If you care about the exact size of the model or you are making a multi-part model, it is best to use offsets and dimensions which are multiples of three.
Areas straddling the line 180 degrees east/west probably won't work. If you want to model an area where this matters (perhaps in Fiji or the Aleutians) let me know and I'll fix it.
Examples
Ben Nevis
This crosses a tile boundary - needs both srtm_35_01.asc and srtm_36_01.asc.
hills -p 56.812,-4.99 ben-nevis.stl
Mont Blanc
Needs srtm_30_03.asc. We use a size of 500x1000 arcseconds and a base altitude of 500m.
hills -p 45.8334,6.8650 -d 500x1000 -b 500 mont-blanc.stl
Part of the Grand Canyon
hills -p 36.13,-111.93 -d 1200x1500 -b 200 grand-canyon.stl
Mount Kilimanjaro
Needs srtm_44_13.asc.
hills -p -3.076,37.35 -d 1500x1500 -b 600 kilimanjaro.stl
Ochil hills
A 1:50000 scale model covering an area about 26km x 13km, in eight parts each about 13cm x 13cm.
hills -p 56.145,-3.96 -s 50 -d 210x375 --offset 0,0 ochils-a0.stl
hills -p 56.145,-3.96 -s 50 -d 210x375 --offset 0,375 ochils-a1.stl
hills -p 56.145,-3.96 -s 50 -d 210x375 --offset 0,750 ochils-a2.stl
hills -p 56.145,-3.96 -s 50 -d 210x375 --offset 0,1125 ochils-a3.stl
hills -p 56.145,-3.96 -s 50 -d 210x375 --offset 210,0 ochils-b0.stl
hills -p 56.145,-3.96 -s 50 -d 210x375 --offset 210,375 ochils-b1.stl
hills -p 56.145,-3.96 -s 50 -d 210x375 --offset 210,750 ochils-b2.stl
hills -p 56.145,-3.96 -s 50 -d 210x375 --offset 210,1125 ochils-b3.stl
The parts are laid out like this:
b0 b1 b2 b3
a0 a1 a2 a3