Skip to content

Commit 45c3611

Browse files
authored
revert(config): Add resizeKernel into the config tileset then disable fastShrinkOnLoad. (#3383)
### Motivation We are adding the background in the imagery importing process(#3379), so we don't need this for fixing the edge effects. ### Modifications This reverts commit bd3357e. ### Verification <!-- TODO: Say how you tested your changes. -->
1 parent 0450412 commit 45c3611

File tree

5 files changed

+4
-13
lines changed

5 files changed

+4
-13
lines changed

packages/config-loader/src/json/json.config.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,6 @@ export class ConfigJson {
247247
if (tileSet.type === TileSetType.Raster) {
248248
if (ts.outputs) tileSet.outputs = ts.outputs;
249249
if (ts.background) tileSet.background = ts.background;
250-
if (ts.resizeKernel) tileSet.resizeKernel = ts.resizeKernel;
251250
}
252251

253252
if (ts.format) {

packages/config-loader/src/json/parse.tile.set.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { ConfigTileSetOutputParser, parseRgba, TileResizeKernel, TileSetType } from '@basemaps/config';
1+
import { ConfigTileSetOutputParser, parseRgba, TileSetType } from '@basemaps/config';
22
import { z } from 'zod';
33

44
export function validateColor(str: string): boolean {
@@ -57,8 +57,6 @@ const zLayerConfig = z
5757
},
5858
);
5959

60-
const TileResizeKernel = z.enum(['nearest', 'mitchell', 'lanczos3', 'lanczos2']);
61-
6260
export const zTileSetConfig = z.object({
6361
type: z.nativeEnum(TileSetType),
6462
id: z.string(),
@@ -70,7 +68,6 @@ export const zTileSetConfig = z.object({
7068
minZoom: zZoom.optional(),
7169
maxZoom: zZoom.optional(),
7270
format: z.string().optional(),
73-
resizeKernel: z.object({ in: TileResizeKernel, out: TileResizeKernel }).optional(),
7471
outputs: z.array(ConfigTileSetOutputParser).optional(),
7572
});
7673

packages/config/src/config/tile.set.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export interface ConfigLayer extends Partial<Record<EpsgCode, string>> {
3131
maxZoom?: number;
3232
}
3333

34-
export type TileResizeKernel = 'nearest' | 'mitchell' | 'lanczos3' | 'lanczos2';
34+
export type TileResizeKernel = 'nearest' | 'lanczos3' | 'lanczos2';
3535

3636
export interface ConfigTileSetBase extends ConfigBase {
3737
/** Human friendly display name for the tileset */

packages/tiler-sharp/src/index.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -144,12 +144,7 @@ export class TileMakerSharp implements TileMaker {
144144

145145
if (resize) {
146146
const resizeOptions = { fit: Sharp.fit.cover, kernel: resize.scaleX > 1 ? resizeKernel.in : resizeKernel.out };
147-
if (resize.scale <= 0.1251) {
148-
// If the scale is less than 0.125, we need to disable fastShrinkOnLoad to prevent edge artifacts for topo raster map
149-
sharp.resize(resize.width, resize.height, { ...resizeOptions, fastShrinkOnLoad: false });
150-
} else {
151-
sharp.resize(resize.width, resize.height, resizeOptions);
152-
}
147+
sharp.resize(resize.width, resize.height, resizeOptions);
153148
}
154149

155150
if (crop) sharp.extract({ top: crop.y, left: crop.x, width: crop.width, height: crop.height });

packages/tiler/src/raster.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export interface TileMaker {
77
compose(ctx: TileMakerContext): Promise<{ buffer: Buffer; metrics: Metrics }>;
88
}
99

10-
export type ResizeKernelType = 'nearest' | 'mitchell' | 'lanczos3' | 'lanczos2';
10+
export type ResizeKernelType = 'nearest' | 'lanczos3' | 'lanczos2';
1111
export type TileMakerResizeKernel = { in: ResizeKernelType; out: ResizeKernelType };
1212

1313
export interface TileMakerContext {

0 commit comments

Comments
 (0)