hills: Generate STL models from SRTM elevation data.

[ bsd3, geography, program ] [ Propose Tags ]

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.

[Skip to Readme]


Note: This package has metadata revisions in the cabal description newer than included in the tarball. To unpack the package including the revisions, use 'cabal get'.

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees


Versions [RSS],,, 0.1.2,,,,,,,
Dependencies array (>=0.5.1 && <0.6), base (>=4.8 && <4.16), bytestring (>=0.10.6 && <0.12), directory (>=1.2.2 && <1.4), filepath (>=1.4.0 && <1.5), optparse-applicative (>=0.11.0 && <0.17), text (>=1.2.1 && <1.3), transformers (>=0.4.2 && <0.7) [details]
License BSD-3-Clause
Copyright (c) 2014, 2015 David Fletcher
Author David Fletcher
Maintainer david@bubblycloud.com
Revised Revision 2 made by djf at 2021-08-25T11:10:32Z
Category Geography
Home page http://www.bubblycloud.com/hills/
Source repo head: git clone https://github.com/davidfletcher/hills.git
Uploaded by djf at 2020-10-06T13:59:24Z
Reverse Dependencies 1 direct, 0 indirect [details]
Executables hills
Downloads 7911 total (27 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs not available [build log]
Last success reported on 2020-10-06 [all 2 reports]

Readme for hills-

[back to package description]


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 david@bubblycloud.com

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.


--position 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

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

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

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.


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.


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