[mapserver-users] elevation profile

Stephen Woodbridge woodbri at swoodbridge.com
Thu Apr 26 20:20:44 EDT 2012

On 4/26/2012 7:35 PM, Puneet Kishor wrote:
> Any suggestions on how something like this could be implemented using MapServer?
> http://viewer.nationalmap.gov/example/elevation_profile.html
> My front-end is OpenLayers, and the backend data are from SRTM. I'd like to click on the map and create a line, and get back the elevation numbers for that line. I only want the elevation numbers as I can optionally construct the profile via a variety of ways.
> I am assuming I could send a line WKT, but how would I query for the values using MapServer?
> Fwiw, http://dev.openlayers.org/sandbox/camptocamp/canvas/openlayers/examples/elevationCanvas.html seems to use a canvas implementation that doesn't seem to be available in my standard-issue OL 2.11. Calling `this.layer.getPixelDataForViewPortPx` croaks with "not a function" message. In any case, I don't really want the RGB values under the mouse. I want the actual height values.
> Thanks in advance for any suggestions,

Hi Puneet,

I have done this in the past and there are a bunch of moving parts. Here 
is what I did.

1. got a copy of NED2 data for the US.
2. create a gdal .vrt file to pull all the files into a single virtual file
3. wrote a simple C fcgi program to take an x,y and get the elevation 
from the the NED2 data.


4. I used pgRouting to compute a route and then took the route geometry 
and added sample point along the edges where needed, and hit the fcgi 
service to convert the points to elevations and then plotted the 
elevations against the their length along the line that the x,y represented.

I also think I may have wrote an app where you could pass the route 
polyline to it an it would generate an image of the elevation plot.

5. Then wired it into the web page as an ajax call of as a image url 
that gets updated.

-Steve W

More information about the mapserver-users mailing list