Skip to content

Commit e0c8127

Browse files
author
Vincent van der Wal
committed
use a 2x for the tiles
1 parent 02404bb commit e0c8127

File tree

4 files changed

+10
-7
lines changed

4 files changed

+10
-7
lines changed

.env

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
VITE_DOMAIN=dwd_icon_d2
22
VITE_VARIABLE=temperature_2m
3-
VITE_TILE_SIZE=512
3+
VITE_TILE_SIZE=256
44
VITE_TILE_OPACITY=70
55
VITE_BUILD=package

src/main.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@ if (params.get('domain')) {
2626

2727
const TILE_SIZE = Number(import.meta.env.VITE_TILE_SIZE);
2828

29-
console.log(TILE_SIZE);
30-
3129
let map: maplibregl.Map;
3230
const infoBox: HTMLElement | null = document.getElementById('info_box');
3331
const mapContainer: HTMLElement | null = document.getElementById('map_container');
@@ -96,10 +94,13 @@ const changeOMfileURL = () => {
9694
variableSelector.disabled = true;
9795
dateTimeSelector.disabled = true;
9896

97+
console.log(import.meta.env.DEV);
98+
9999
source = map.addSource('omFileSource', {
100100
type: 'raster',
101101
url: 'om://' + omUrl,
102-
tileSize: TILE_SIZE
102+
tileSize: TILE_SIZE,
103+
volatile: import.meta.env.DEV
103104
});
104105

105106
map.addLayer(
@@ -140,7 +141,8 @@ if (mapContainer) {
140141
source = map.addSource('omFileSource', {
141142
type: 'raster',
142143
url: 'om://' + omUrl,
143-
tileSize: TILE_SIZE
144+
tileSize: TILE_SIZE,
145+
volatile: import.meta.env.DEV
144146
});
145147

146148
map.addLayer(

src/om-protocol.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ interface Data {
6060

6161
let data: Data;
6262

63-
const TILE_SIZE = Number(import.meta.env.VITE_TILE_SIZE);
63+
const TILE_SIZE = Number(import.meta.env.VITE_TILE_SIZE) * 2;
6464

6565
export const getValueFromLatLong = (lat: number, lon: number, omUrl: string) => {
6666
if (data) {
@@ -125,6 +125,7 @@ const getTile = async ({ z, x, y }: TileIndex, omUrl: string): Promise<ImageBitm
125125
};
126126

127127
const renderTile = async (url: string) => {
128+
console.log(url);
128129
// Read URL parameters
129130
const re = new RegExp(/om:\/\/(.+)\/(\d+)\/(\d+)\/(\d+)/);
130131
const result = url.match(re);

src/worker.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import {
1616
import type { TypedArray } from '@openmeteo/file-reader';
1717
import type { Domain } from './types';
1818

19-
const TILE_SIZE = Number(import.meta.env.VITE_TILE_SIZE);
19+
const TILE_SIZE = Number(import.meta.env.VITE_TILE_SIZE) * 2;
2020
const OPACITY = Number(import.meta.env.VITE_TILE_OPACITY);
2121

2222
const rotatePoint = (cx: number, cy: number, theta: number, x: number, y: number) => {

0 commit comments

Comments
 (0)