Generate OpenSCAD source code from elevation data
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


Generate OpenSCAD source code from elevation data. I don't provide code for getting elevation data because providers might have their own license. You need to write your own for getting that.

Save your elevation data into elevations.dat with the format longitude latitude elevation and order by [longitude, latitude].

After elevations.dat is ready, run python Use OpenSCAD to open the generated evelation.scad which requires my library dotSCAD.

You can use the gen_surface_from function to generate data for surface. Just uncomment the line in

if __name__ == "__main__":
    ymin, yinc, thickness, scale = 21.750, 0.015, -1, 100
    # generate elevation.scad
    # gen_scad_from('elevations.dat', ymin, yinc, thickness, scale = scale)
    # generate surface.dat
    gen_surface_from('elevations.dat', ymin, yinc)

After generating surface.dat, write surface.scad containing the following.

surface(file = "surface.dat", center = true, convexity = 5);

The model shown below is Taiwan, generated from data that latitude from 21.75 to 25.500 and longitude from 119.900 to 122.100.


You can use -math.inf to reserve original elevation below sea level.