Skip to content
GuidesBlogPlaygroundDashboard

Look up elevation for multiple coordinates

client.Elevation.Batch(ctx, params) (*ElevationBatchResult, error)
POST/api/v1/elevation/batch

Look up elevation for multiple coordinates

ParametersExpand Collapse
params ElevationBatchParams
Coordinates param.Field[[]ElevationBatchParamsCoordinate]

Body param: Coordinates to look up elevations for (max 50)

Lat float64

Latitude in decimal degrees (-90 to 90)

maximum90
minimum-90
Lng float64

Longitude in decimal degrees (-180 to 180)

maximum180
minimum-180
Format param.Field[string]optional

Query param: Response format: json (default), geojson, csv, ndjson

ReturnsExpand Collapse
type ElevationBatchResult struct{…}

GeoJSON FeatureCollection of elevation Point Features with 3D coordinates. Order matches the input coordinates array.

Elevation results in the same order as input coordinates

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 ElevationLookupResultProperties
ElevationM float64

Elevation in meters above mean sea level (WGS84 EGM96 geoid)

Type ElevationLookupResultType
Type ElevationBatchResultType

Look up elevation for multiple 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"),
  )
  elevationBatchResult, err := client.Elevation.Batch(context.TODO(), githubcomplazafyiplazago.ElevationBatchParams{
    Coordinates: githubcomplazafyiplazago.F([]githubcomplazafyiplazago.ElevationBatchParamsCoordinate{githubcomplazafyiplazago.ElevationBatchParamsCoordinate{
      Lat: githubcomplazafyiplazago.F(48.856600),
      Lng: githubcomplazafyiplazago.F(2.352200),
    }, githubcomplazafyiplazago.ElevationBatchParamsCoordinate{
      Lat: githubcomplazafyiplazago.F(45.764000),
      Lng: githubcomplazafyiplazago.F(4.835700),
    }}),
  })
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", elevationBatchResult.Features)
}
{
  "features": [
    {
      "geometry": {
        "coordinates": [
          2.3522,
          48.8566
        ],
        "type": "Point"
      },
      "properties": {
        "elevation_m": 35.2
      },
      "type": "Feature"
    }
  ],
  "type": "FeatureCollection"
}
Returns Examples
{
  "features": [
    {
      "geometry": {
        "coordinates": [
          2.3522,
          48.8566
        ],
        "type": "Point"
      },
      "properties": {
        "elevation_m": 35.2
      },
      "type": "Feature"
    }
  ],
  "type": "FeatureCollection"
}