Wolfram Language Paclet Repository
Community-contributed installable additions to the Wolfram Language
Earthworks design and quantification toolkit
Contributed by: Malcolm Woodruff
LineTerra turns the Wolfram Language into an earthworks design and quantification workstation. Its core method threads a cross-section template along an alignment and calculates its intersection with the existing ground; a separate polygon tool handles footprint-based earthworks such as building pads. Although most worked examples design roads -- horizontal alignment with circular or Bezier intersection-point curves, vertical profile with K-value parabolic curves, and cross-section templates carrying carriageway links, cut and fill batters, ditches, walls and bridge or tunnel structures -- the same procedure applies to slope-stability cross-sections, dam design and reservoir volumes, drainage networks, and single-building pads. Output covers cut and fill quantities including a mass-haul diagram, 3D visualization, and export to CSV, true-scale PDF, PNG, DXF and native notebooks.
To install this paclet in your Wolfram Language environment,
evaluate this code:
PacletInstall["MalcolmWoodruff/LineTerra"]
To load the code after installation, evaluate this code:
Needs["MalcolmWoodruff`LineTerra`"]
Open the LineTerra toolbar for a project. This is the entry point to every other window -- Terrain, Plan/Profile, Intersect, Templates, Sections, Earthwork, Export, 3D View and Bake Road. Evaluating it again with the same name reopens that road; with a different name it opens another road on the same terrain:
| In[1]:= |
| Out[1]= | ![]() |
The alignment and profile geometry is plain kernel code. Cumulative chainage along a three-point alignment:
| In[2]:= |
| Out[2]= |
Rounding the corner with a 40 m arc shortens the route from the 200 m walked by the two straight legs:
| In[3]:= |
| Out[3]= |
The design level at a chainage, with a parabolic vertical curve applied at the crest. The grade changes from +10% to -5%, a change of 15%, so a K-value of 5 gives a 75 m vertical curve:
| In[4]:= |
| Out[4]= |
Terrain comes from whichever source suits the stage of the project. A GeoTIFF elevation raster, with its.tfw world file or with the georeferencing tags embedded in the file itself:
| In[5]:= |
A LIDAR point cloud, gridded from its ground-classified points. A.laz file needs PDAL or LASzip on the system path; a.las file is read with no external tool:
| In[6]:= |
A synthetic corridor strip following the assumed route centreline, which keeps a very long route's terrain to a workable size. Make the number of cross samples odd, so one falls on the centreline:
| In[7]:= |
Work can be carried out in latitude and longitude or in a national grid, and most countries' grids are supported. Converting to the British National Grid:
| In[8]:= |
| Out[8]= |
Any UTM zone or other supported projection can be named by its EPSG code directly:
| In[9]:= |
| Out[9]= |
Cross-sections export to PDF at an exact drawing scale, to a notebook as named vector graphics, or to true-scale DXF. DXF coordinates are real-world metres -- one drawing unit is one metre -- with geometry separated onto per-section GROUND, DESIGN and SCALE layers:
| In[10]:= |
First, evaluate the follwoing and you will get the main menu. Choose New Project then Terrain:
| In[11]:= |
| Out[11]= | ![]() |
Press LAZ/LAS point Cloud. If it is a LAZ file then you must have PDAL or LASzip on the system path, e. g.: brew install pdal. (See “Read this first). If you have or it is a LAS file the file will be read directly:

The preview can be shown in the normal way:

Pressing Plan and then adding IPs to form a road alignment:

Extracting a profile:

Either open a template library or design new ones. Here we have opened the library so we can use the motorway and bridge templates:

Assign sections to the alignment:

Calculating earthworks we get an updated plan:

And earthwork quantities:

Leaving Earthworks on Auto we can then adjust the profile and/or the planned alignment and the quantities and plan will instantly update:



The road can be baked into the terrain and a 3D image produced. Sections or the plan can be exported to scale:

Wolfram Language Version 13.0