Raruto / leaflet-elevation

Leaflet plugin that allows to add elevation profiles using d3js
GNU General Public License v3.0
255 stars 85 forks source link

Drop value in diagram #41

Closed ZhukDmitry closed 4 years ago

ZhukDmitry commented 4 years ago

Hi. Thanks again for your work. It's me again.

Here my diagram 2020-03-02_22-15-35

In my data there is no empty ele tags, but I have break to low value

I can give you my GPX file

2020-03-02_22-21-49

In addition to this as you can see yAxis have the wrong padding with value more than 1000

;) Dmitry

Raruto commented 4 years ago

In my data there is no empty ele tags, but I have break to low value

Probably a value results as a negative infinite value.

If you are interested in understanding better, the following function is responsible for calculating the addition of a new point:

https://github.com/Raruto/leaflet-elevation/blob/13154800917497155b63a91d0049864523e963f4/leaflet-elevation.js#L545

ZhukDmitry commented 4 years ago

OK. I found, it was a wrong value in file. Closed.

Raruto commented 4 years ago

OK. I found, it was a wrong value in file.

Could you let me have the offending piece of code? Already null values are discarded, is it something else that we can fix?

ZhukDmitry commented 4 years ago

No. It was wrong value in file. I don't know how it was, but all your code is fine.

<trkpt lat="38.894764222204685" lon="1.218488495796919">
  <ele>-5.15</ele>
  <time>2018-03-26T13:54:58Z</time>
</trkpt>
<trkpt lat="38.894764976575971" lon="1.218519257381558">
  <ele>-1500</ele>
    <time>2018-03-26T13:55:04Z</time>
</trkpt>
<trkpt lat="38.894730359315872" lon="1.218582037836313">
  <ele>-3.23</ele>
  <time>2018-03-26T13:55:20Z</time>
</trkpt>

I step by step remove values and found. I think it was device error to create records.

Thanks for your help..

Raruto commented 4 years ago

OK thanks.

This is a common problem for tunnels too, it would be nice to have a setting to try to mitigate these types of problems.

ZhukDmitry commented 4 years ago

For example if current elevation and previous differs more than 20-30% then take average (previous - next). But tunnel can be long ;)