I am trying to make my own version of code to generate elevation profile for a line drawn over a DEM and I got stuck very early on.
As a simple use case: I have a line that consists of just two points that are, say, 5 km apart. Since my DEM has a resolution of, say, 90 meters, I'd like my sampling points to be 90 meters apart, along the line.
I understand that there are tools in QGIS and GRASS that can achieve this easily (Calculating elevation profile along line from a DEM?) but they just give out the distance of each point along one axis in the final graph.
Ideally, I need to identify all the pixels on the DEM that this line passes over. If this is not possible, at least getting the location of all sampling points along the shapefile would be what I am aiming for - a kind of 3D shapefile with the elevation value for each point along with (lon,lat).
At the very least, it would be great to have an algorithm/pseudo code to make a simple line more complex by adding points to it every x distance from its origin.