-
Notifications
You must be signed in to change notification settings - Fork 17
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
feat(config): Add resizeKernel into the config tileset then disable fastShrinkOnLoad. BM-1146 #3377
Merged
Conversation
This file contains 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 - We thought about how to carry through a
But haven't figured out a clean way to do it. |
blacha
reviewed
Dec 5, 2024
blacha
reviewed
Dec 5, 2024
tawera-manaena
changed the title
feat(config): Add resizeKernel into the config tileset then disable fastShrinkOnLoad.
feat(config): Add resizeKernel into the config tileset then disable fastShrinkOnLoad. BM-1146
Dec 5, 2024
blacha
approved these changes
Dec 5, 2024
github-merge-queue bot
pushed a commit
that referenced
this pull request
Jan 6, 2025
… pixels BM-1146 (#3379) ### Motivation As a Basemaps user, when I view the [NZTopo Raster Maps][nztopo-raster-maps] from afar (low zoom level), I can see black edge artifacts around the perimeter of the imagery. | [Topo 50][basemaps-topo50] | [Topo250][basemaps-topo250] | | - | - | | ![][topo50] | ![][topo250] | | Appears between zoom levels `0-6` inclusive. Hard to notice when zoom level is `>= 6.5` | Appears between zoom levels `0-4` inclusive. Hard to notice when zoom level is `>= 4.5` | _You 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][kernel-pr] 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 `background` parameter to the `cover` command. - When the user provides the parameter, the `create` function will perform two additional `gdal` steps after `gdalwarp` and before `gdal_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 | For a given tile | What cogify usually makes | What cogify can now make | | - | - | - | | ![][verification-tile] | ![][verification-before] | ![][verification-after] | | Example shown: [9-4-325][basemaps-9-4-325] - Web Mercator (EPSG:3857) | No transparent pixels are overwritten. | All transparent pixels are overwritten with the provided background colour. | <!-- links --> [nztopo-raster-maps]: https://dev.basemaps.linz.govt.nz/@-41.8899962,174.0492437,z5?style=topo-raster&i=topographic&config=TmVmbYRQjL9T2JWgyaSie193b4D1qZnBD8hjaSqPFYSsEvEYYhaGYKrcp1HoDE7nHXaP89x5RKia68nGwyRKku4ExE7QvB424FYmjokRMr2qXgj6oehUjHaB27QiY6d [basemaps-topo50]: https://basemaps.linz.govt.nz/@-40.4900187,173.5118508,z5?style=01JE7PGRG2AHNAN80CVCBK5JS1&i=01JE7PGRG2AHNAN80CVCBK5JS1&config=5LN3whfVkKeLNsSo5jGHMuw3a3bk5rR1ekotn4iApaGccpE1D8L2hLZdbsYkzbUrGCFpy2jXFkbngKguAkob2ZKZHKkKGTw6xx1f14Zxe2VaPmUV3PNRTJero5NDH1WgtA16AnKtaRVXQ7KaQevPzeTfwNmxdWZECGqDkps59ifDDuTAQJXXJK6rfMk3tF15s&debug=true [basemaps-topo250]: https://basemaps.linz.govt.nz/@-41.8971463,173.1394504,z4?style=01JE7NBEJHND65K0WWWB9PWXQZ&i=01JE7NBEJHND65K0WWWB9PWXQZ&config=L8TuzSUutDHnXXerPsYTDJdYLrUMAR6yseMyXuNiLyqvD5SPvX6E3CkoPoqhkogKnBCaQpbQ7LUHiSXGsM9ctAVTvjWU8BnSaV3SrRRGDULg5PSGz8thtzn5BGc28bijrqq677m9gSHJqVdwXPsjQ78pKez8TMncCYth2s4npjkmokz7q2r1GgMumQ3WTjT72y&debug=true [topo50]: https://github.com/user-attachments/assets/aaa16253-efed-45b9-a6bd-fb6054b33927 [topo250]: https://github.com/user-attachments/assets/64655fe0-b5ad-4036-aab6-2810fef3c578 [kernel-pr]: #3377 [basemaps-9-4-325]: https://basemaps.linz.govt.nz/@-43.8859446,-176.8266051,z8?debug=true&debug.tile=true [verification-tile]: https://github.com/user-attachments/assets/2159eb1d-3009-4aec-a747-d886cd51df32 [verification-before]: https://github.com/user-attachments/assets/3889e3a2-c784-4436-94d4-f264dc546866 [verification-after]: https://github.com/user-attachments/assets/89018eb0-4aad-437d-a4fd-f4f62c10eb54 --------- Co-authored-by: Wentao Kuang <wkuang@linz.govt.nz> Co-authored-by: Blayne Chard <bchard@linz.govt.nz>
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 raster Topo map got edge effects on low zoom levels usually below zoom 6, like following.
We have tests that with output resize kernel of
mitchell
and disable the fastShrinkOnLoad for lower scales levels will fix this problem.Modifications
Add the resiseKernel setting in the config bundle, so that we can bundle it into server.
disable
fastShrinkOnLoad
for theresize.scale
less than 0.125.Not fix yet: The virtual tileset for
topo-raster-50k
andtopo-raster-250k
won't fix as we can't propagate the resize kernel from combined tileset -> imagery config -> virtual tileset. Unless we add optional resizeKernal property for imagery config.Verification
Local test.