sample elevation profile generation code from Mathieu-Leplatre