-
Notifications
You must be signed in to change notification settings - Fork 19
feat(cogify): add background color support for overriding transparent pixels BM-1146 #3379
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
Merged
Wentao-Kuang
merged 17 commits into
master
from
feat/cogify-add-background-color-support
Jan 6, 2025
Merged
feat(cogify): add background color support for overriding transparent pixels BM-1146 #3379
Wentao-Kuang
merged 17 commits into
master
from
feat/cogify-add-background-color-support
Jan 6, 2025
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
blacha
reviewed
Dec 16, 2024
blacha
reviewed
Dec 16, 2024
blacha
reviewed
Dec 16, 2024
blacha
reviewed
Dec 16, 2024
blacha
reviewed
Dec 16, 2024
blacha
reviewed
Dec 16, 2024
blacha
reviewed
Dec 20, 2024
blacha
reviewed
Dec 20, 2024
blacha
approved these changes
Dec 23, 2024
Merged
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))
github-merge-queue bot
pushed a commit
to linz/topo-workflows
that referenced
this pull request
Feb 28, 2025
) ### Motivation As a Basemaps user, I want to consume the NZTopo 50 & 250 Maps [as a tile service]. ### Modification This work defines a new Argo `topo-maps-standardising` workflow and an update to the existing `imagery-import-cogify` workflow. We have used this work to generate and publish the [NZ Topo Gridless Maps] layer to basemaps. 1. **`topo-maps-standardising` (new)** This work defines a new Argo [topo-maps-standardising] workflow for coordinating the standardisation of an NZTopo Map Series imagery collection. We have designed the workflow to handle the following collections stored in the AWS S3 [TopoReleaseArchive] directory: ``` s3://topographic-upload/TopoReleaseArchive/NZTopo50_GeoTif_Gridless/ s3://topographic-upload/TopoReleaseArchive/NZTopo250_GeoTif_Gridless/ ``` To support this workflow, we have introduced new [Topo Raster processes] to the `basemaps\cogify` package. This workflow executes these new processes as part of its process flow. **This workflow has two key steps:** For an NZTopo Map Series imagery collection: - Generate a directory structure of STAC Item and Collection files - Standardise the contained GeoTIFF imagery files and save them within the generated directory structure From this, we can pass the resulting directories into the [imagery-import-cogify] workflow to process the standardised imagery into basemaps, either for previewing, or publishing. 2. **`imagery-import-cogify` (update)** This work also updates the [imagery-import-cogify] workflow to support the new background parameter for the CLI `create` command of the `basemaps/cogify` package. This allows the command to override any transparent pixels with a fixed colour. In this work's context, this allows us to eliminate [imagery artifacts] that used to appear around the COGs, particularly for NZTopo Map Series imagery. <!-- external links --> [NZ Topo Gridless Maps]: https://basemaps.linz.govt.nz/@-41.8899962,174.0492437,z5?style=topo-raster&i=topo-raster [as a tile service]: linz/basemaps#3365 (comment) [TopoReleaseArchive]: https://linz-topographic-upload.s3.ap-southeast-2.amazonaws.com/topographic/TopoReleaseArchive/ [Topo Raster processes]: linz/basemaps#3388 [topo-maps-standardising]: https://github.com/linz/topo-workflows/pull/932/files#diff-985cd50a4d3d95216b2aac800f8f1590a1ac94d4e3d1041ade2f09ce0e1b5bc6 [imagery-import-cogify]: https://github.com/linz/topo-workflows/pull/932/files#diff-5b88dd6435a818dfac26161a8270f7f4ae499f9771f91e7c8ac08d807f033845 [background parameter]: linz/basemaps#3379 [imagery artifacts]: linz/basemaps#3379 (comment)
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.
Motivation
As a Basemaps user, when I view the NZTopo Raster Maps from afar (low zoom level), I can see black edge artifacts around the perimeter of the imagery.
0-6inclusive. Hard to notice when zoom level is>= 6.50-4inclusive. Hard to notice when zoom level is>= 4.5You may need to open each image/link in a new tab to see the black lines more clearly.
Problem
We suspect the issue resides in the way the basemaps/tiler composes a small tile. The resizing down of many pixels into one, causes artifacts to appear where opaque pixels meet transparent pixels.
Solution
There is already a 'workaround' fix that treats the symptoms of the black edge artifacts. This work, however, seeks to treat the source of the issue by providing a mechanism to replace all transparent pixels with opaque pixels. The effect being to erase such areas where opaque pixels meet transparent pixels.
Modifications
basemaps/cogify
We have added a
backgroundparameter to thecovercommand.When the user provides the parameter, the
createfunction will perform two additionalgdalsteps aftergdalwarpand beforegdal_translate, to ensure that any and all transparent pixels that would otherwise appear in the resulting tile, are replaced with the provided background colour.gdal_create- To create a background image where all pixels are set to the provided background colour.gdalbuildvrt- To layer the background image behind the source GeoTIFF files after reprojection.Verification