The hills package

[Tags:bsd3, program]

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 It outputs STL.

Consult for full instructions.

[Skip to Readme]


Versions,,, 0.1.2,,,,
Dependencies array (>=0.5.1 && <0.6), base (>=4.8 && <4.10), bytestring (>=0.10.6 && <0.11), directory (>=1.2.2 && <1.4), filepath (>=1.4.0 && <1.5), optparse-applicative (>=0.11.0 && <0.14), text (>=1.2.1 && <1.3), transformers (>=0.4.2 && <0.6) [details]
License BSD3
Copyright (c) 2014, 2015 David Fletcher
Author David Fletcher
Stability Unknown
Category Geography
Home page
Source repository head: git clone
Uploaded Wed Jan 18 10:37:39 UTC 2017 by djf
Distributions NixOS:
Downloads 758 total (10 in the last 30 days)
0 []
Status Docs not available [build log]
Last success reported on 2017-01-18 [all 3 reports]


Maintainer's Corner

For package maintainers and hackage trustees

Readme for hills

Readme for 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 It outputs binary STL.

In spite of its name the program also works on valleys.

-- David Fletcher

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 or a mirror.

You want the ArcInfo ASCII format. The download interface on the website is painful so you may find it easier just to construct a direct URL.


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