elevationPointGet method

Future<ElevationData> elevationPointGet({
  1. required ORSCoordinate geometry,
  2. String formatOut = 'geojson',
  3. String dataset = 'srtm',
})

Fetches the ElevationData by taking a 2D geometry and enriching it with elevation from a variety of datasets. Uses the GET method for the endpoint.

Information about the endpoint, parameters, response etc. can be found at: https://openrouteservice.org/dev/#/api-docs/elevation/point/get

Implementation

Future<ElevationData> elevationPointGet({
  required ORSCoordinate geometry,
  String formatOut = 'geojson',
  String dataset = 'srtm',
}) async {
  // Extract coordinate information.
  final double lat = geometry.latitude;
  final double lng = geometry.longitude;

  // Build the request URL.
  final Uri uri = Uri.parse(
    '$_elevationEndpointURL/point?api_key=$_apiKey&geometry=$lng,$lat&format_out=$formatOut&dataset=$dataset',
  );
  final Map<String, dynamic> data = await _openRouteServiceGet(uri: uri);
  return ElevationData.fromJson(data);
}