More playing with srtm data: altiph
After importing srtm data into postgis, it was time to query and use that data.
When given longitude and latitude, altiphp queries the database and returns altitude. Actually, it queries the altitude for nearest available points, and performs a bilinear interpolation (I took the idea from route-altitude-profile). When given an array of points, altiphp returns an array of altitude.
altiphp can add points to give a more accurate route profile. For example, if you have two points at the top of two mountains, altiphp knows how to add points between them each one separated of about 90m from the next one (90m is srtm resolution). You get then an accurate route profile going down to the valley and then climbing back to the other mountain. This behavior is of course optional.
Altiphp also integrates with gisconverter.php. When gisconverter is available, altiphp can handle geometries directly.
If you have not imported srtm data in a postgis database, you can use non-postgis mode. In this mode, altiphp downloads data files form usgs server, optionally stores them for future retrieval, and parses them to extracts data. This works fine, gets the same results as postgis mode, but parsing the file is really slow and each file, once parsed, takes about 300Mo in memory. So, using this method is not a good idea for a website, even a small one, but this can be helpful in some cases, for example for a seldom used local application or for testing.
altiphp needs php 5.3, is licensed under modified bsd license and is available at github.