All examplesMaps
Find the elevation of a point
Click anywhere on the map and the point beneath the cursor gets sampled against the national 30 m DEM, returned as a height in metres above CGVD2013.
live result
the code that produced it
import { Unmap } from "@unmap/sdk";
const unmap = new Unmap({
key: "um_live_...",
container: "map",
center: [-114.0719, 51.0447],
zoom: 11,
});
const [metres] = await unmap.elevation.get([-114.0719, 51.0447]);
unmap.map!.on("click", async (e) => {
const [here] = await unmap.elevation.get([e.lngLat.lng, e.lngLat.lat]);
console.log(here === null ? "no data here" : `${here} m`);
});A click outside the dataset's coverage, such as far offshore, comes back null. That means the
archive has nothing there, not that the point sits at sea level.
The Elevation API documents the endpoint behind this example.