API reference - Point

GPXZ has a single enpoint for querying an individual point. You can also use the multi-point endpoints with a single point.

/v1/elevation/point

Query the elevation at a single location.

Example request

GET https://api.gpxz.io/v1/elevation/point?lat=57.66&lon=11.90

Example response

{
    "result": {
        "elevation": 38.263489, 
        "lat": 57.66, 
        "lon": 11.9, 
        "data_source": "copernicus_30m", 
        "resolution": 30
    }, 
    "status": "OK"
}

Request query parameters

  • lat: latitude, in degrees. Required.
  • lon: longitude, in degrees. Required.
  • bathymetry: if true return distance below sea level for points on the ocean (i.e., elevation will be negative). If false return 0 for points on the ocean. Default: false.
  • interpolation: which algorithm to use for interpolating between pixels in the underlying raster data. bilinear is smoother if displaying multiple points, but is slower and may reduce the extremity of peaks and troughs. Options: nearest, bilinear. Default: bilinear.

Response

A json object.

  • result.elevation: elevation in metres at the provided point.
  • result.lat: parsed latitude.
  • result.lon: parsed longitude.
  • result.data_source: ID of the open data source was used to build this area of the GPXZ dataset. You can use this ID to lookup more details with the /v1/elevation/sources endpoint.
  • result.resolution: approximate resolution in metres of the GPXZ dataset in this area.
  • status: OK for successful request.

Python example

Querying the elevation of a single location using Python. The requests package is used here: it may already be installed in your python environment, otherwise you can install it with pip install requests.

import requests
    
API_KEY = "YOUR-API-KEY-HERE"

latitude = 25.345
longitude = 131.034
url = "https://api.gpxz.io/v1/elevation/point"

response = requests.get(
    url,
    headers={"x-api-key": API_KEY},
    params={"lat": latitude, "lon": longitude},
)

# Throw an error if the request failed, rather than ploughing on with bad data.
response.raise_for_status()

print(response.json())