Raruto / leaflet-elevation

Leaflet plugin that allows to add elevation profiles using d3js

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Leaflet elevation get track properties (Length, Elevation, time, etc)

cesar2 opened this issue · comments

Subject of the issue

Is there a way to get the track properties in a similar way it can be done with leaflet-gpx from javascript?

Like:

  • get_distance(): returns the total track distance, in meters
  • get_start_time(): returns a Javascript Date object representing the starting time
  • get_end_time(): returns a Javascript Date object representing when the last point was recorded
  • get_moving_time(): returns the moving time, in milliseconds
  • get_total_time(): returns the total track time, in milliseconds
  • get_moving_pace(): returns the average moving pace in milliseconds per km
  • get_moving_speed(): returns the average moving speed in km per hour
  • get_total_speed(): returns the average total speed in km per hour
  • get_elevation_min(): returns the lowest elevation, in meters
  • get_elevation_max(): returns the highest elevation, in meters
  • get_elevation_gain(): returns the cumulative elevation gain, in meters

Thanks a million

Your environment

  • leaflet-elevation: Latest
  • leaflet: 1.9.4
  • browser: chrome
  • operating system: win10
var map = new L.Map('map');
var controlElevation = L.control.elevation(options).addTo(map);
controlElevation.load("https://raruto.github.io/leaflet-elevation/examples/via-emilia.gpx");
controlElevation.on('eledata_loaded', ({ track_info }) => { console.log(track_info.distance + " km"); });