Skip to content
GuidesBlogPlaygroundDashboard

Elevation profile along coordinates

client.Elevation.Profile(ctx, body) (*ElevationProfileResult, error)
POST/api/v1/elevation/profile

Elevation profile along coordinates

ParametersExpand Collapse
body ElevationProfileParams
ElevationProfileRequest param.Field[ElevationProfileRequest]

Request body for elevation profile along a path. Provide at least 2 coordinates defining the path. Maximum 50 coordinates per request.

ReturnsExpand Collapse
type ElevationProfileResult struct{…}

GeoJSON LineString Feature with 3D coordinates [lng, lat, elevation] representing the elevation profile along the input path. Summary statistics are in properties.

GeoJSON Geometry object per RFC 7946. Coordinates use [longitude, latitude] order. 3D coordinates [lng, lat, elevation] are used for elevation endpoints.

Coordinates GeoJsonGeometryCoordinatesUnion

Coordinates array. Nesting depth varies by geometry type: Point = [lng, lat], LineString = [[lng, lat], ...], Polygon = [[[lng, lat], ...], ...], etc.

One of the following:
type GeoJsonGeometryCoordinatesPoint []float64

[longitude, latitude] or [longitude, latitude, elevation]

type GeoJsonGeometryCoordinatesLineStringOrMultiPoint [][]float64

Array of [lng, lat] positions

type GeoJsonGeometryCoordinatesPolygonOrMultiLineString [][][]float64

Array of linear rings / line strings

type GeoJsonGeometryCoordinatesMultiPolygon [][][][]float64

Array of polygons

Type GeoJsonGeometryType

Geometry type

One of the following:
const GeoJsonGeometryTypePoint GeoJsonGeometryType = "Point"
const GeoJsonGeometryTypeLineString GeoJsonGeometryType = "LineString"
const GeoJsonGeometryTypePolygon GeoJsonGeometryType = "Polygon"
const GeoJsonGeometryTypeMultiPoint GeoJsonGeometryType = "MultiPoint"
const GeoJsonGeometryTypeMultiLineString GeoJsonGeometryType = "MultiLineString"
const GeoJsonGeometryTypeMultiPolygon GeoJsonGeometryType = "MultiPolygon"
Properties ElevationProfileResultProperties

Elevation profile summary statistics

AvgElevationM float64

Average elevation along the profile in meters

MaxElevationM float64

Maximum elevation along the profile in meters

MinElevationM float64

Minimum elevation along the profile in meters

TotalAscentM float64

Total cumulative elevation gain in meters

TotalDescentM float64

Total cumulative elevation loss in meters

Type ElevationProfileResultType

Elevation profile along coordinates

package main

import (
  "context"
  "fmt"

  "github.com/plazafyi/plaza-go"
  "github.com/plazafyi/plaza-go/option"
)

func main() {
  client := githubcomplazafyiplazago.NewClient(
    option.WithAPIKey("My API Key"),
  )
  elevationProfileResult, err := client.Elevation.Profile(context.TODO(), githubcomplazafyiplazago.ElevationProfileParams{
    ElevationProfileRequest: githubcomplazafyiplazago.ElevationProfileRequestParam{
      Coordinates: githubcomplazafyiplazago.F([]githubcomplazafyiplazago.ElevationProfileRequestCoordinateParam{githubcomplazafyiplazago.ElevationProfileRequestCoordinateParam{
        Lat: githubcomplazafyiplazago.F(48.856600),
        Lng: githubcomplazafyiplazago.F(2.352200),
      }, githubcomplazafyiplazago.ElevationProfileRequestCoordinateParam{
        Lat: githubcomplazafyiplazago.F(48.858000),
        Lng: githubcomplazafyiplazago.F(2.340000),
      }, githubcomplazafyiplazago.ElevationProfileRequestCoordinateParam{
        Lat: githubcomplazafyiplazago.F(48.858400),
        Lng: githubcomplazafyiplazago.F(2.294500),
      }}),
    },
  })
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", elevationProfileResult.Geometry)
}
{
  "geometry": {
    "coordinates": [
      2.3522,
      48.8566
    ],
    "type": "Point"
  },
  "properties": {
    "avg_elevation_m": 67.8,
    "max_elevation_m": 155.3,
    "min_elevation_m": 28.1,
    "total_ascent_m": 127.4,
    "total_descent_m": 89.2
  },
  "type": "Feature"
}
Returns Examples
{
  "geometry": {
    "coordinates": [
      2.3522,
      48.8566
    ],
    "type": "Point"
  },
  "properties": {
    "avg_elevation_m": 67.8,
    "max_elevation_m": 155.3,
    "min_elevation_m": 28.1,
    "total_ascent_m": 127.4,
    "total_descent_m": 89.2
  },
  "type": "Feature"
}