GIScience / GIScience/Leaflet.Heightgraph

Handle missing elevation data

Open
#108 5 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
101
Forks
40
PR merge metrics
No merged PRs in 30d

Description

Heightgraph currently doesn't handle cases where part or all of the data points have coordinates, but no elevation/altitude value.

This results in incomplete graphs and NaN errors/warnings, see comparison below and the Plunker console:

current | expected
-- | --
[Plunker](http://plnkr.co/edit/BWSX4Y9XjCdyLCiy?preview) | [Plunker](http://plnkr.co/edit/0jLCagjFvf2o0HNZd09M?p=preview), see also [Elevation#84](https://github.com/MrMufflon/Leaflet.Elevation/pull/84)
![image](https://user-images.githubusercontent.com/1092030/99651738-4a2e4600-2a57-11eb-8540-99b028a332d4.png) | ![image](https://user-images.githubusercontent.com/1092030/73591679-d89a0100-44f1-11ea-92ab-03f2ab4417d2.png)

Diagrams shown are variants of the same elevation profile with missing values at different positions:
1. original
2. middle (left of second segment)
3. left
4. right
5. all missing

Reasons for missing elevation data e.g. are using CGIAR CSI SRTM that has no data beyond 60 degrees north and south and outside shorelines, see abrensch/brouter#137, nrenner/brouter-web#203.

The suggested solution would be to show missing elevation values as gaps by using a d3 [defined](https://github.com/d3/d3-shape/blob/master/README.md#area_defined) accessor function, e.g. [here](https://github.com/GIScience/Leaflet.Heightgraph/blob/9e45353ae01e4389124701bdacb62ee255d3fec1/src/L.Control.Heightgraph.js#L776-L780):
```
d3Area().defined(d => d.altitude !== undefined && d.altitude !== null)
```

I guess I could provide a PR if no one else feels like it.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.