Improve DEM bounding box selection when product coordinates are in a different projection than the DEM#275
Open
gshiroma wants to merge 29 commits into
Open
Improve DEM bounding box selection when product coordinates are in a different projection than the DEM#275gshiroma wants to merge 29 commits into
gshiroma wants to merge 29 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR improves the DEM bounding box selection when the product bounding box projection differs from the DEM projection, the previous implementation reprojected only the four corners of the bounding box to determine the DEM extent.
This is inaccurate when reprojecting between coordinate systems where straight edges become curves (e.g. UTM to geographic), causing the computed bounding box to miss the bulge introduced by geodetic curvature. The result was a DEM subset that was too small, leading to interpolation failures or incorrect elevation values near the edges.
Instead of projecting the four corners only, all four edges of the input bounding box are now densely sampled (
n_edge_samplespoints per edge, default11) before reprojection, ensuring the true geographic extent is captured regardless of projection curvature.The antimeridian handling is simplified. Rather than treating the western and eastern edges separately, a single check over all sampled points is performed. If the DEM is in geographic coordinates and the reprojected X range exceeds 180 degrees, longitudes are remapped to [0, 360] before computing the extent.