Be resilient to files with data issues
- Dominant language
- Rust
- Stars
- 54
- Forks
- 1
- PR merge metrics
- No merged PRs in 30d
Description
Terraform works great when using the USGS .adf file suggested in the blog post, but using one from [this area around Lake Champlain](https://viewer.nationalmap.gov/basic/?basemap=b1&category=ned&q=&zoom=11&bbox=-73.58848572,44.38374722,-72.92037964,44.75258502&preview=&avail=&refpoly=) results in what is essentially a very long, narrow plane.

It seems the reason is hinted at in this console output:
`Total points: 1168561
Max 1617.8933 min -340282350000000000000000000000000000000
`
It looks like there's a data issue with the file itself (or possibly with how GDAL processes it), but it would be nice for Terraform to work anyway.
A bad fix that works for this file is to check on https://github.com/jaredly/terraform/blob/master/src/terrain.rs#L395 if `p` is negative, and set it to `0` if so. That won't work for every file (land below sea level) and, trickier, also probably messes up the scaling. I'm not yet sure what a good fix would be.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start at src/terrain.rs around line 395 and inspect how elevation values from USGS .adf files are processed and scaled. Reproduce the issue with the linked Lake Champlain data, then verify that malformed values no longer create a long narrow model while valid below-sea-level data remains correct.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- computer-graphics
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100