cog-tiler
TypeScript icon, indicating that this package has built-in type declarations

0.0.21 • Public • Published

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

Package Sidebar

Install

npm i cog-tiler

Weekly Downloads

1

Version

0.0.21

License

MIT

Unpacked Size

40.5 kB

Total Files

12

Last publish

Collaborators

  • tsurutan