[mapserver-users] elevation profile

Fawcett, David (MPCA) David.Fawcett at state.mn.us
Fri Apr 27 14:30:45 EDT 2012


It would likely not be as efficient, but you could also utilize an elevation service for that part of it:

http://cumulus.cr.usgs.gov/XMLWebServices2/Elevation_Service.asmx

http://developer.mapquest.com/web/products/open/elevation-service


-----Original Message-----
From: mapserver-users-bounces at lists.osgeo.org [mailto:mapserver-users-bounces at lists.osgeo.org] On Behalf Of Stephen Woodbridge
Sent: Thursday, April 26, 2012 10:40 PM
To: Puneet Kishor
Cc: mapserver-users at lists.osgeo.org
Subject: Re: [mapserver-users] elevation profile

On 4/26/2012 10:49 PM, Puneet Kishor wrote:
>
> On Apr 26, 2012, at 7:20 PM, Stephen Woodbridge wrote:
>
>> 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.
>>
>> http://imaptools.com:8080/cgi-bin/getElevation.fcgi?lat=32.662864999999996&lon=-86.880096999999992
>>
>>
>>
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.
>>
>
>
>
> Thanks for the details, Steve. All this is way more complicated that
> I was envisioning. And, PostGIS 2 is out of the question, for now, at
> least.
>
> Could you send me that gdal .vrt file? I'd like to look at it.
> Perhaps that will give me some other ideas on how to approach this.

Puneet,

GDAL has a utility gdalbuildvrt the creates the .vrt file I think I ran 
it something like:

gdalbuildvrt ned2.vrt /u/data/ned2/*.tif

run gdalbuildvrt with no arguments to get some help.

If you want you could use mapserver and set up a point query against the 
ned2 data to get the elevation, then write a php wrapper to take the 
polyline and sample it and call mapserver to get the elevations along 
the polyline and you the php gd code to plot it out.

-Steve
_______________________________________________
mapserver-users mailing list
mapserver-users at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users




More information about the mapserver-users mailing list