- Hono -> Hi(火🔥)
- Cloud Optimized GeoTIFF(COG) -> gear -> Haguruma(歯車⚙️)
- geomatico/maplibre-cog-protocol is amazing work to consume COG on browser, maximizing performance of geotiff.js and provides utilities to colorize raster data.
- It is also good the process to load COG and tiling them on server in terms of utilize shared cache.
npm install higuruma
import { renderTile, locationValues } from 'higuruma/dist/index.esm.js'; // ES Module
// const { renderTile, locationValues } = require('higuruma/dist/index.cjs.js'); // CommonJS
const tile = await renderTile('https://path/to/cog.tif', z, x, y); // ArrayBuffer of PNG
const values = await locationValues('https://path/to/cog.tif', {latitude, longitude}); // pixel values
npm install
npm run deploy # needs credentials
/tile/{z}/{x}/{y}?url=https://path/to/cog.tif
: content-type isimage/png
/values?url=https://path/to/cog.tif&lat=35.681236&lon=139.767125
: return pixel value at the given lat/lon
inspired by developmentseed/titiler
- This codes includes many codes derived from geomatico/maplibre-cog-protocol, modified to fit on Node.js.