From 3cc3da619568eeb9c8aab291847ef679fd23345f Mon Sep 17 00:00:00 2001 From: Miko Date: Wed, 8 Jan 2025 00:38:08 +0100 Subject: [PATCH] apply linter changes --- src/serve_data.js | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/src/serve_data.js b/src/serve_data.js index f64cd05..78d7817 100644 --- a/src/serve_data.js +++ b/src/serve_data.js @@ -230,12 +230,7 @@ export const serve_data = { xy = [intX, intY]; bbox = new SphericalMercator().bbox(intX, intY, zoom); } else { - if ( - x < -180 || - y < -90 || - x > 180 || - y > 90 - ) { + if (x < -180 || y < -90 || x > 180 || y > 90) { return res.status(404).send('Out of bounds'); } @@ -290,12 +285,14 @@ export const serve_data = { siny = Math.min(Math.max(siny, -0.9999), 0.9999); const xWorld = TILE_SIZE * (0.5 + long / 360); - const yWorld = TILE_SIZE * (0.5 - Math.log((1 + siny) / (1 - siny)) / (4 * Math.PI)); + const yWorld = + TILE_SIZE * + (0.5 - Math.log((1 + siny) / (1 - siny)) / (4 * Math.PI)); const scale = 1 << zoom; - const xTile = Math.floor(xWorld * scale / TILE_SIZE); - const yTile = Math.floor(yWorld * scale / TILE_SIZE); + const xTile = Math.floor((xWorld * scale) / TILE_SIZE); + const yTile = Math.floor((yWorld * scale) / TILE_SIZE); const xPixel = Math.floor(xWorld * scale) - xTile * TILE_SIZE; const yPixel = Math.floor(yWorld * scale) - yTile * TILE_SIZE; @@ -317,9 +314,9 @@ export const serve_data = { let elevation; if (encoding === 'mapbox') { elevation = - -10000 + ((red * 256 * 256 + green * 256 + blue) * 0.1); + -10000 + (red * 256 * 256 + green * 256 + blue) * 0.1; } else if (encoding === 'terrarium') { - elevation = (red * 256 + green + blue / 256) - 32768 + elevation = red * 256 + green + blue / 256 - 32768; } else { elevation = 'invalid encoding'; } @@ -334,7 +331,7 @@ export const serve_data = { blue, latitude: lat, longitude: long, - elevation + elevation, }), ); };