lint format

This commit is contained in:
acalcutt 2025-01-02 18:23:52 -05:00
parent 6fddbae157
commit 8186aa1df0

View file

@ -123,15 +123,13 @@ export const serve_data = {
return res.status(200).send(data);
});
app.get('/:id/elevation/:z/:x/:y',
async (req, res, next) => {
app.get('/:id/elevation/:z/:x/:y', async (req, res, next) => {
try {
const item = repo?.[req.params.id];
if (!item) return res.sendStatus(404);
if (!item.source) return res.status(404).send('Missing source');
if (!item.tileJSON) return res.status(404).send('Missing tileJSON');
if (!item.sourceType)
return res.status(404).send('Missing sourceType');
if (!item.sourceType) return res.status(404).send('Missing sourceType');
const { source, tileJSON, sourceType } = item;
if (sourceType !== 'pmtiles' && sourceType !== 'mbtiles') {
return res
@ -191,13 +189,7 @@ export const serve_data = {
const { minX, minY } = new SphericalMercator().xyz(tileCenter, z);
xy = [minX, minY];
}
const fetchTile = await fetchTileData(
source,
sourceType,
z,
x,
y,
);
const fetchTile = await fetchTileData(source, sourceType, z, x, y);
if (fetchTile == null) return res.status(204).send();
let data = fetchTile.data;
@ -227,8 +219,7 @@ export const serve_data = {
const blue = imgdata.data[index + 2];
let elevation;
if (encoding === 'mapbox') {
elevation =
-10000 + (red * 256 * 256 + green * 256 + blue) * 0.1;
elevation = -10000 + (red * 256 * 256 + green * 256 + blue) * 0.1;
} else if (encoding === 'terrarium') {
elevation = red * 256 + green + blue / 256 - 32768;
} else {
@ -266,8 +257,7 @@ export const serve_data = {
.header('Content-Type', 'text/plain')
.send(err.message);
}
},
);
});
app.get('/:id.json', (req, res) => {
const item = repo[req.params.id];