In planning routes for roads and canals, topography is often a significant
constraint. Among the infinite number of possible trajectories between two
points, the selected path should be a good approximation to the one with th
e least cost, and should avoid extremes of slopes. In the case of a canal,
the number of uphill reaches of the trajectory should be minimised. This pa
per presents a least-cost-path algorithm developed to End the best path giv
en the topography, the start and end-points of the linear feature (canal or
road) and a function relating slope, distance and cost. The algorithm is b
ased on dynamic programming techniques adapted to solve problems on the gri
d, or raster structure usually used in Geographical Information Systems. Th
e algorithm was programmed and used to solve hypothetical problems. Althoug
h real cost functions were not used, the results were coherent and showed t
he algorithm's capabilities.