Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle missing elevation data #108

Open
nrenner opened this issue Nov 19, 2020 · 4 comments · May be fixed by #110
Open

Handle missing elevation data #108

nrenner opened this issue Nov 19, 2020 · 4 comments · May be fixed by #110

Comments

@nrenner
Copy link

nrenner commented Nov 19, 2020

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 Plunker, see also Elevation#84
image image

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 accessor function, e.g. here:

d3Area().defined(d => d.altitude !== undefined && d.altitude !== null)

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

@boldtrn
Copy link
Contributor

boldtrn commented Nov 19, 2020

Have you considered filling emtpy slots on your side? That way you could interpolate the elevation or fill it with 0 etc., depending on your needs.

I am not sure if this plugin should fix "incorrect"/"missing" data?

@nrenner
Copy link
Author

nrenner commented Nov 20, 2020

A corresponding issue is Elevation #63 with a few upvotes and another PR, so we're not the only ones.

While interpolation or assuming 0 might work for some cases, it will be misleading or just wrong for others. I personally would expect missing elevation data to be reflected in the graph as such.

@boldtrn
Copy link
Contributor

boldtrn commented Nov 20, 2020

Setting it to 0 would result in the same rendering result as you shown above wouldn't it?

The difference would then be that when hovering over the entry that instead of showing 0 there would be something like "not defined"? That said, feel free to propose a PR and check back with @TheGreatRefrigerator if this features is desired for this repo.

@nrenner
Copy link
Author

nrenner commented Dec 16, 2020

Setting it to 0 would result in the same rendering result as you shown above wouldn't it?

Not quite. The connection would be different and rest would only look the same because this artificial example has a min height of 0 and I disabled extending the elevations bounds for better comparison.

With a more realistic example the differences are:

  • the graph outline is flattened when the elevation range is extended to 0
  • defined cuts the graph off with a vertical line, while with 0 it connects normally with a diagonal line to the next data point
  • due to elevation bounds extension by 10%, the graph visibly continues at height 0, making the filling look like an actual height of 0

0 filling:

image

defined:

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants