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

[SEDONA-477] Shift the origin of clip results to zero #1231

Merged
merged 1 commit into from
Feb 2, 2024

Conversation

Kontinuation
Copy link
Member

Did you read the Contributor Guide?

Is this PR related to a JIRA ticket?

What changes were proposed in this PR?

The result of RS_Clip returns GridCoverage2D objects containing JAI images with non-zero origin when crop = true. This will bring a full range of problems when handling such GridCoverage2D objects, because lots of band operation code assumes that the JAI images have zero origin, and the BufferedImage of AWT also does not allow images with non-zero origin, which make it difficult to construct image objects from in-memory buffer.

We decide to make all GridCoverage2D objects having zero origin, rather than fixing all band operation routines to make them handle non-zero origins correctly, since this is very difficult. We defined a helper function RasterUtils.shiftRasterToZeroOrigin to shift raster with non-zero origin to have zero origin, and shift the affine transformation to cancel with the origin shift, thus to keep the actual grid coverage unchanged.

Untitled Diagram drawio (1)

How was this patch tested?

Add test to validate that the result of RS_Clip has zero origin.

Did this PR include necessary documentation updates?

  • No, this PR does not affect any public API so no need to change the docs.

@Kontinuation Kontinuation marked this pull request as ready for review February 2, 2024 02:56
@jiayuasu jiayuasu added this to the sedona-1.6.0 milestone Feb 2, 2024
@jiayuasu jiayuasu merged commit 4562a7b into apache:master Feb 2, 2024
46 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants