Back to HomePublic API
Terrain Elevation API
A free public API that returns elevation data for any location on Earth. Powers the 3D Terrain Explorer.
Base URL
https://map-api.psiegel.orgTry:
API Documentation
Authentication
No authentication required. The API is open for public use.
Rate Limiting
- • Uses Open-Topo-Data backend with automatic request batching
- • Responses are cached for 30 days via Cloudflare KV
- • Please be respectful with request frequency
Endpoint
GET https://map-api.psiegel.orgQuery Parameters
| Name | Type | Required | Description |
|---|---|---|---|
q | string | Yes* | Location search query (e.g., "Mount Everest") |
lat | number | Yes* | Latitude coordinate |
lon | number | Yes* | Longitude coordinate |
size | number | No | Area size in km (default: 10, max: 200) |
grid | number | No | Grid resolution (default: 20, options: 20, 30, 40) |
* Either q OR both lat and lon are required.
Response Fields
name- Resolved location name from geocodingcenter- Center coordinates [lat, lon] of the terrain areaelevations- Flat array of elevation values (grid × grid) in metersminElev- Minimum elevation in the area (meters)maxElev- Maximum elevation in the area (meters)grid- Grid resolution used
Example Requests
# Search by location name
curl "https://map-api.psiegel.org?q=Grand%20Canyon&size=20&grid=20"
# Search by coordinates
curl "https://map-api.psiegel.org?lat=36.0544&lon=-112.1401&size=20&grid=20"
Success Response
{
"name": "Grand Canyon Village, Coconino County, Arizona, United States",
"center": [36.0544, -112.1401],
"elevations": [1800, 1850, 1900, ...],
"minElev": 750,
"maxElev": 2200,
"grid": 20
}Error Response
{
"error": "Location not found"
}JavaScript Example
async function getTerrainData(location, options = {}) {
const params = new URLSearchParams({
q: location,
size: options.size || 10,
grid: options.grid || 20
});
const response = await fetch(`https://map-api.psiegel.org?${params}`);
const data = await response.json();
if (data.error) {
throw new Error(data.error);
}
return data;
}
// Example usage
const terrain = await getTerrainData('Mount Fuji', { size: 30, grid: 30 });
console.log(`Elevation range: ${terrain.minElev}m - ${terrain.maxElev}m`);Python Example
import requests
def get_terrain_data(location, size=10, grid=20):
response = requests.get('https://map-api.psiegel.org', params={
'q': location,
'size': size,
'grid': grid
})
data = response.json()
if 'error' in data:
raise Exception(data['error'])
return data
# Example usage
terrain = get_terrain_data('Swiss Alps', size=50)
print(f"Center: {terrain['center']}")
print(f"Elevation range: {terrain['minElev']}m - {terrain['maxElev']}m")Data Sources
- Geocoding: OpenStreetMap Nominatim
- Elevation: Open-Topo-Data SRTM 90m dataset
Notes
- • The
elevationsarray is in row-major order (top-left to bottom-right) - • Grid size affects both detail and response time (larger = slower)
- • Very large areas (>100km) may have lower effective resolution due to SRTM data limits