Closed mhaque02 closed 3 years ago
Hi Syam,
if I'm not mistaken, geojson standard doesn't define a common format where to save time
information (eg. inside the properties
value).
If not provided, time
information is not calculated programmatically by this library (as speed depends on time you always get 0).
For gpx files, time data is parsed within this event: https://github.com/Raruto/leaflet-elevation/blob/42b557c928445064b6e48464913bbc3fe803155e/src/time.js#L18
(search for meta
propery inside mpetazzoni/leaflet-gpx/gpx.js for more info)
Take a look at these other files to fully understand:
Here here you can find an example of how to write your own library in order to add a custom chart profile (eg. for "knots"). As usual, pull request are well accepted.
Have a nice day, Raruto
From version 1.5.5 you can use the following options:
speed: true,
speedLabel: 'knts',
speedFactor: 0.539956803455724, // 1 km/h = 0.539956803455724 knots
Take a look at speed-chart.html and time.geojson for a complete example.
NB remember to update speedFactor
accordingly if you also set imperial: true
If needed, you can also use the following parameters:
acceleration: true,
accelerationLabel: /* label */,
accelerationFactor: /* constant */,
See: src/speed.js and src/acceleration.js for more info about them.
Take a look to tmcw/togeojson if you are interested in how to generate a geojson file with proper coordTimes
properties.
Happy testing, Raruto
Is there any example of the speed/acceleration graph? I added
speed: true
to the options but it just shows 0.I am using a GeoJSON file with [latitude, longitude, altitude]
I did not see any examples or documentation regarding how to implement speed in the data or what it is using to calculate this. Additionally, is there any way to change units per data point? For example I would like the altitude to remain as feet but speed should be in terms of "knots" (for aviation)