Function sampleElevationProfile

  • Samples elevation at evenly spaced points along a line and returns a profile with per-sample distance + elevation plus gain/loss/min/max stats.

    The line is resampled into sampleCount points spaced by equal great-circle distance (not by vertex), so the profile is independent of how densely the input line is digitized. Elevation at each point comes from the supplied ElevationSampler; samplers may be async and are awaited in order. No DOM or map dependency.

    Returns Promise<ElevationProfile>

    when line has fewer than two coordinates.