[mapserver-users] elevation profile

pcreso at pcreso.com pcreso at pcreso.com
Fri Apr 27 11:36:42 PDT 2012


Hi Puneet

I suggest you use GMT - the best open source cartographic & grid analysis tool available!  http://gmt.soest.hawaii.edu

you may need your SRTM surface as a GMT netCDF grid, which GDAL supports nicely, or you may be able to describe your SRTM grid for GMT to use natively - I'm not sure

the project command will generate your line, with sample points along it as straight or great circle lines between end points

grdtrack will turn your XY line coordinates into xyz values, with the Z values derived from your SRTM grid

psxy will gernerate a nicely annotated graphic (postscript) showing your profile
psxyz can (alternatively) render your profile in 3d space (overlaid on a 3D perspective view of the surface if required)

ps2raster will convert to a raster image such as png. 

This can easily be wrapped up in a cgi if required.

Cheers,

    Brent Wood

--- On Fri, 4/27/12, Puneet Kishor <punk.kish at gmail.com> wrote:

From: Puneet Kishor <punk.kish at gmail.com>
Subject: Re: [mapserver-users] elevation profile
To: "Stephen Woodbridge" <woodbri at swoodbridge.com>
Cc: mapserver-users at lists.osgeo.org
Date: Friday, April 27, 2012, 2:49 PM


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.

Many thanks,


--
Puneet Kishor

_______________________________________________
mapserver-users mailing list
mapserver-users at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20120427/b81809c0/attachment.htm>


More information about the MapServer-users mailing list