Giter Club home page Giter Club logo

srtm's Introduction

SRTM

build Join the chat at https://gitter.im/Itinero/Lobby Visit our website

  • SRTM: NuGet Badge

A simple library to load SRTM data and return heights in meter for a given lat/lon. Based on Alpinechough.Srtm .

Usage

// 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.
var srtmData = new SRTMData(@"/path/to/data/cache", new USGSSource());
// NASA data is of a higher resolution, but requires creating an account at https://urs.earthdata.nasa.gov/users/new/.
var credentials = new NetworkCredential("username", "password");
var srtmData = new SRTMData(@"/path/to/data/cache", new NASASource(credentials));

// get elevations for some locations
int? 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 accuracy
double? 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);

Data sources

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.

We need help!

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.