tilezen / joerd

Joerd can be used to download, merge and generate tiles from digital elevation data
MIT License
323 stars 49 forks source link

Coastal resampling #41

Open zerebubuth opened 8 years ago

zerebubuth commented 8 years ago

We have the following problem near the coast:

Interpolation badness

In this example, the red data is something like GMTED or SRTM for which we have no bathymetry, and the blue data is something of lower resolution but with bathymetry, such as ETOPO1. The problem occurs because the NODATA (represented by the empty circle) can't interpolate into the sea - and we wouldn't want it to, as we have no data there. But the lower resolution dataset fills in with something that will probably be a shallower gradient, given the wider spacing between data points. This leads to a "halo" around the land, and it's particularly bad near cliffs. It gets worse still when there's an offset mis-match between the data sets and the coastline is at different positions.

There are many ways to fix this. Some random thoughts:

  1. Interpolate bathymetry and height data separately, and composite them. For example; first interpolate all land stuff with NODATA set to 0, composite that together. Then interpolate all the water stuff with NODATA set to zero, composite that together. Then use a water/land mask to chose between the two. This would require a high resolution coastline shapefile.
  2. Backfill at the native resolution. At the moment, we mask each data source with NODATA at their native resolution, then warp / interpolate them to the target projection and composite them. The issue arises because we are interpolating a source with NODATA, so we could start by warping ETOPO1 to GMTED resolution, compositing there, then warping to SRTM resolution and compositing there, etc... The downside is that all the re-warping going on is likely to blur / produce artefacts in the earlier data sources.
  3. Use a cleverer algorithm for interpolation. See "Improving quality of public domain digital elevation models through data fusion" by Karkee, Steward, Abd Aziz for one way of doing this. Another would be to interpolate over a locally-reconstructed TIN of the "best" data points which aren't NODATA. Either way, this approach would likely produce the best results, but be the most complex to implement.

There will be other ways that I've missed. Thoughts?

NomadicDeveloper22 commented 1 year ago

Recently come across this repo, but is it abandoned? Because this seems like this definitely needs fixed, and this issue is 7 years old