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

fix(tiler-sharp): when resampling uint round numbers rather than truncate BM-1178 #3392

Merged
merged 1 commit into from
Jan 22, 2025

Conversation

blacha
Copy link
Member

@blacha blacha commented Jan 22, 2025

Motivation

When resampling uint it can end up resampling slightly high or low eg resampling 1 can result in 1.00..01 or 0.99999..

When setting a number on a Uint8Array floating point numbers are truncated, so 0.9999 will be rounded down to 0 rather than up to 1.

Modifications

When resampling uint round numbers before assigning them.

Verification

Added unit test to validate rounding

@blacha blacha marked this pull request as ready for review January 22, 2025 02:46
@blacha blacha requested a review from a team as a code owner January 22, 2025 02:46
@tawera-manaena
Copy link
Contributor

tawera-manaena commented Jan 22, 2025

@blacha blacha added this pull request to the merge queue Jan 22, 2025
Merged via the queue into master with commit d02e56f Jan 22, 2025
13 checks passed
@blacha blacha deleted the fix/resize-resampling-rounding branch January 22, 2025 02:56
@blacha blacha changed the title fix(tiler-sharp): when resampling uint round numbers rather than truncate fix(tiler-sharp): when resampling uint round numbers rather than truncate BM-1178 Jan 26, 2025
@blacha blacha mentioned this pull request Jan 26, 2025
github-merge-queue bot pushed a commit that referenced this pull request Jan 26, 2025
# [7.14.0](v7.13.0...v7.14.0)
(2025-01-26)


### Bug Fixes

* **infra:** correct dist path location
([#3390](#3390))
([46f8fb8](46f8fb8))
* revert "build: maplibre v5.0.0
([#3387](#3387))"
([#3394](#3394))
([d441be2](d441be2))
* **tiler-sharp:** when resampling uint round numbers rather than
truncate ([#3392](#3392))
([d02e56f](d02e56f))


### Features

* **cogify:** add background color support for overriding transparent
pixels BM-1146 ([#3379](#3379))
([b8bedc3](b8bedc3))
* improved cloudwatch analytics rollup BM-1092
([#3381](#3381))
([de2f295](de2f295))
* **tiler-sharp:** support uint32 and uint8 source datasets for
color-ramp ([#3391](#3391))
([f316042](f316042))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants