Elevation (Vietnam) API
Terrain elevation in metres for any point in Vietnam and nearby (Copernicus DEM 90 m): one point, 100 points or a path profile with gain and loss.
lat + lon returns the height above mean sea level (EGM2008 geoid) at that point, interpolated bilinearly between the four surrounding samples of the Copernicus DEM GLO-90 grid (3 arc-seconds, about 90 m). points takes up to 100 points ([[lat, lon], …], [{lat, lon}] or lat,lon|lat,lon). path (a polyline of up to 100 vertices, or a GeoJSON LineString) with samples (2–500, default 100) returns an elevation profile at evenly spaced distances plus start / end / min / max height, total gain and loss and the steepest grade.
Coverage: the box 8–24° N, 102–110° E (Vietnam, Laos, Cambodia and parts of Thailand and southern China). The open sea has no DEM tile and returns 0 (source: "ocean"); points outside the box return null (out_of_coverage). The DEM is a surface model: it includes buildings and forest canopy, so heights in cities and forests are a few metres above the ground, and narrow peaks are smoothed (Fansipan reads about 3 100 m for 3 143 m).
Licence: Copernicus DEM, free for commercial use with the attribution returned in attribution (keep it visible). The tiles are static: they are rebuilt only when Copernicus publishes a new release.
Parameters
| Name | In | Type | Required | Default | |
|---|---|---|---|---|---|
lat | query | number | no | Latitude of one point (with lon). | |
lon | query | number | no | Longitude (lng accepted). | |
points | body|query | array | no | Up to 100 points: [[lat, lon], …], [{lat, lon}] or lat,lon|lat,lon. | |
path | body|query | array | no | Polyline (2–100 vertices, same formats, or a GeoJSON LineString) for an elevation profile. | |
samples | body|query | number | no | 100 | Profile samples along path (2–500). |
Example
curl -X POST "https://apibox.io.vn/v1/elevation" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"path":[[22.3367,103.8438],[22.3033,103.775]],"samples":50}'const res = await fetch('https://apibox.io.vn/v1/elevation', {
method: 'POST',
headers: {
Authorization: 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json',
},
body: JSON.stringify({
"path": [
[
22.3367,
103.8438
],
[
22.3033,
103.775
]
],
"samples": 50
}),
});
const data = await res.json();
console.log(data);import requests
res = requests.post(
"https://apibox.io.vn/v1/elevation",
headers={"Authorization": "Bearer YOUR_API_KEY"},
json={"path": [[22.3367, 103.8438], [22.3033, 103.775]], "samples": 50},
timeout=30,
)
print(res.json())<?php
$ch = curl_init('https://apibox.io.vn/v1/elevation');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_HTTPHEADER => ['Authorization: Bearer YOUR_API_KEY', 'Content-Type: application/json'],
CURLOPT_POSTFIELDS => '{"path":[[22.3367,103.8438],[22.3033,103.775]],"samples":50}',
]);
$response = curl_exec($ch);
print_r(json_decode($response, true));Response
{
"distance_m": 7992.4,
"samples": 50,
"spacing_m": 163.1,
"summary": {
"start_m": 1507.1,
"end_m": 3101.9,
"min_m": 1246.9,
"max_m": 3101.9,
"gain_m": 2066.2,
"loss_m": 471.4,
"max_grade_percent": 78.8
},
"profile": [
{
"distance_m": 0,
"lat": 22.3367,
"lon": 103.8438,
"elevation_m": 1507.1
},
{
"distance_m": 163.1,
"lat": 22.336018,
"lon": 103.842396,
"elevation_m": 1501.7
},
"…",
{
"distance_m": 7992.4,
"lat": 22.3033,
"lon": 103.775,
"elevation_m": 3101.9
}
],
"note": "Copernicus DEM GLO-90 is a surface model (3 arc-seconds, ~90 m): heights include buildings and trees, relative to the EGM2008 geoid (≈ mean sea level); typical error a few metres, more on steep slopes. Ocean = 0. …",
"coverage": {
"south": 8,
"north": 24,
"west": 102,
"east": 110,
"note": "Vietnam and neighbouring areas for now"
},
"data_version": "20261111",
"attribution": "Produced using Copernicus WorldDEM-90 © DLR e.V. 2010-2014 and © Airbus Defence and Space GmbH 2014-2018 provided under COPERNICUS by the European Union and ESA; all rights reserved. The organisations in charge of the Copernicus programme by law or by delegation do not incur any liability for any use of the Copernicus WorldDEM-90."
}
Use cases
- Show the altitude of a property or farm plot from its coordinates
- Draw the elevation profile and total climb of a running or cycling route
- Estimate flood exposure by comparing ground heights in a district
- Plan telecom or survey sites in mountainous provinces
FAQ
How accurate is it?
Copernicus GLO-90 has a typical vertical error of a few metres on flat open ground, more on steep slopes; at 90 m spacing it cannot see small hills, embankments or single buildings.
Why is the value higher than the ground in a city?
It is a digital surface model: roofs and tree tops are part of the surface. Use it for terrain, not for the floor level of a building.
Will other countries be added?
The first version covers Vietnam and its neighbours. The same pipeline can extend the box later.
Related APIs
JSON Validator
Check JSON syntax with exact line and column of errors, and validate data against a JSON Schema (draft 4, 7, 2019-09 or 2020-12).
{ }JSON Formatter
Pretty print JSON with 0-8 spaces or tabs, minify it, or sort object keys recursively. Syntax errors are reported with line and column.
CSVCSV to JSON
Convert CSV into an array of JSON objects using the header row, with delimiter auto-detection, number and boolean typing, and row-level errors.