Raster API

The GPXZ API now supports 2D extracts!

Define a bounding box:


© OpenStreetMap

and provide the bounding coordinates to the new /v1/elevation/hires-raster, along with your desired resolution

# Build request.
query_params = {
    "bbox_top": "46.531",
    "bbox_bottom": "46.518",
    "bbox_left": "6.629",
    "bbox_right": "6.648",
    "res_m": 2,  # Metres.
    "api-key": os.environ["GPXZ_API_KEY"],

}

# Query data.
response = requests.get(
    "https://api.gpxz.io/v1/elevation/hires-raster",
    params=query_params,
    stream=True,
)
response.raise_for_status()

# Save to file.
dest_path = Path("data/lausanne.geotiff")
with open(dest_path, "wb") as f:
    shutil.copyfileobj(response.raw, f)

The resulting raster can be used for e.g., 2D analysis, mapping, or offline data caching.


Geotiff rendered as a heatmap. The axes are in pixels.

For more details, head over to the raster API documentation.