Open Topo Data

Open Topo Data

Open Data

Elevation and ocean depth for a latitude and longitude

Visit API🔁 Alternatives

📚 Documentation & Examples

Everything you need to integrate with Open Topo Data

🚀 Quick Start Examples

Open Topo Data Javascript Examplejavascript
// Open Topo Data API Example
const response = await fetch('https://www.opentopodata.org/', {
    method: 'GET',
    headers: {
        'Content-Type': 'application/json'
    }
});

const data = await response.json();
console.log(data);

OpenTopoData API: An Overview

Are you looking for a reliable and accurate source of elevation data? Look no further than OpenTopoData. OpenTopoData provides a free, public API that allows users to access terrain elevation data at multiple global scales.

How to Use OpenTopoData API in JavaScript

The OpenTopoData API supports various programming languages, including JavaScript. Using API in JavaScript is pretty straightforward; you just have to send an API request using HTTP GET/POST request within your code.

Here's an example code in JavaScript that illustrates how to retrieve Topographic data from OpenTopoData API:

let xhr = new XMLHttpRequest();
let url = "https://opentopodata.org/v1/samples/full_form?locations=50.684,7.144&source=GTOPO30";
xhr.open("GET", url, true);

xhr.onreadystatechange = function () {
   if (xhr.readyState === 4 && xhr.status === 200) {
      let responseJSON = JSON.parse(xhr.responseText);
      console.log(responseJSON);
   }
};

xhr.send();

Here, we have created a new instance of XMLHttpRequest() and created a URL for our API call. The open() function is then used to open a GET request with the specified URL. The onreadystatechange() function is used as a callback function to be executed when the request receives a response. Finally, we make an API call with send() function to retrieve the desired JSON data.

This will return the following JSON response:

{"status":"ok","samples":[{"location":{"latitude":50.684,"longitude":7.144},"elevation":274.0}]}

You can then proceed to extract the elevation data of interest from the response JSON.

Conclusion

OpenTopoData API offers an amazing opportunity to interact with an easy-to-use and publicly available tool for elevation data retrieval. The API also supports many other useful functions such as seamless OpenLayers integration and good documentation. Happy exploring!

📊 30-Day Uptime History

Daily uptime tracking showing online vs offline minutes

Dec 12Dec 14Dec 16Dec 18Dec 20Dec 22Dec 24Dec 26Dec 28Dec 30Jan 1Jan 3Jan 5Jan 7Jan 1004008001440Minutes
Online
Offline

Related APIs in Open Data