A simple library to load SRTM data and return heights in meter for a given lat/lon. Based on Alpinechough.Srtm .
// create a new srtm data instance.// it accepts a folder to download and cache data into in addition to the source you want to use for the data.// USGS data is immediately available, but is of a lower resolution.varsrtmData=newSRTMData(@"/path/to/data/cache",newUSGSSource());// NASA data is of a higher resolution, but requires creating an account at https://urs.earthdata.nasa.gov/users/new/.varcredentials=newNetworkCredential("username","password");varsrtmData=newSRTMData(@"/path/to/data/cache",newNASASource(credentials));// get elevations for some locationsint?elevation=srtmData.GetElevation(47.267222,11.392778);Console.WriteLine("Elevation of Innsbruck: {0}m",elevation);elevation=srtmData.GetElevation(-16.5,-68.15);Console.WriteLine("Elevation of La Paz: {0}m",elevation);elevation=srtmData.GetElevation(27.702983735525862f,85.2978515625f);Console.WriteLine("Elevation of Kathmandu {0}m",elevation);elevation=srtmData.GetElevation(21.030673628606102f,105.853271484375f);Console.WriteLine("Elevation of Ha Noi {0}m",elevation);// if a smoother result is preferred, it is possible to use bilinear interpolation at the cost of some accuracydouble?smoothElevation=srtmData.GetElevationBilinear(47.267222,11.392778);Console.WriteLine("Elevation of Innsbruck: {0}m",elevation);smoothElevation=srtmData.GetElevationBilinear(-16.5,-68.15);Console.WriteLine("Elevation of La Paz: {0}m",elevation);smoothElevation=srtmData.GetElevationBilinear(27.702983735525862f,85.2978515625f);Console.WriteLine("Elevation of Kathmandu {0}m",elevation);smoothElevation=srtmData.GetElevationBilinear(21.030673628606102f,105.853271484375f);Console.WriteLine("Elevation of Ha Noi {0}m",elevation);We implemented two sources of data, the USGS SRTM and NASA SRTM. If you want to add an extra source, we're accepting pull requests, you just need to implement something like this.
If you think we need to add another source of data let us know via the issues, if you know more about SRTM or of another source of elevation, also let us know.