cog-tiler
v0.0.21
Published
This package reads Cloud Optimized GeoTIFFs from x, y, z tiles and returns PNG images.
Downloads
170
Maintainers
Readme
cog-tiler
Overview
This package allows you to read Cloud Optimized GeoTIFF (COG) files and generate PNG images from xyz tiles. It utilizes geotiff.js
and node-canvas
under the hood.
Installation
npm install cog-tiler
Usage Example
app.get('/tiles/:z/:x/:y', async (req, res) => {
const {x: xs,y: ys,z: zs} = req.params;
const x = Number(xs);
const y = Number(ys);
const z = Number(zs);
const tiff = await fromFile(path.resolve(process.cwd(), "data/sample.tif"));
const image = await tiff.readImage(x, y, z);
tiff.close();
res.setHeader("Content-Type", "image/png");
res.send(image);
});
License
MIT