cogeotiff
Cloud optimized GeoTIFF(COG)を扱うツール
- 完全にJavaScriptベースで、ブラウザとnodejsで動作
- TIFF画像とメタデータを遅延読み込み
- 巨大な100GB以上のCOGに対応
- GDAL TIFFの最適化を利用し、通常はタイルあたり1~2回の読み込みのみ!
- URL、ファイル、Google Cloud、AWS S3からTIFFを読み込み可能
- LINZのBasemapsの本番環境で使用され、数十億のタイルがCOGから取得されています!
使い方
fetchを使ってURLからCOGを読み込む
import { SourceHttp } from '@chunkd/source-http';const source = new SourceHttp('https://example.com/cog.tif');
const cog = await Tiff.create(source);
const img = cog.images[0];
if (img.isTiled()) throw new Error('Tiff is not tiled');
const tile = await img.getTile(2, 2); // Fetch a tile from a tiff x:2, y:2
// Tiff tags can be directly accessed too
img.value(TiffTag.GdalNoData); // "-9999"
// or tag metadata can be fetched
img.tags.get(TiffTag.GdalNoData);
/
{
type: 'inline', // How the tag was read "inline" vs "lazy"
id: 42113, // Tag Id (@see TiffTag)
name: 'GdalNoData', // Tag Name
count: 6, // Number of values
value: '-9999',
dataType: 2, // Char
tagOffset: 194 // Bytes into the file where the tag was read.
}
*/
コマンドラインインターフェース
npm i -g @cogeotiff/clicogeotiff info
COGの基本情報を表示する
cogeotiff info webp.cog.tif
出力:COG File Info - /home/blacha/Downloads/tif-new/bg43.webp.cog.tif Tiff type BigTiff (v43)
Chunk size 64 KB
Bytes read 64 KB (1 Chunk)
Images
Compression image/webp
Origin 18550349.52047286,-5596413.462927464,0
Resolution 19.10925707129406,-19.10925707129415,0
BoundingBox 18550349.52047286,-5713820.738373496,19098250.139221005,-5596413.462927464
Info
Id Size Tile Size Tile Count
0 28672x6144 56x12 672
1 14336x3072 28x6 168
2 7168x1536 14x3 42
3 3584x768 7x2 14
4 1792x384 4x1 4
5 896x192 2x1 2
6 448x96 1x1 1
GDAL
COG optimized true
COG broken false
Tile order RowMajor
Tile leader uint32 - 4 Bytes
Mask interleaved false
cogeotiff ダンプ
画像のすべてのタイルをダンプします(警告 大きなCOGに対してこれを行うと、数百万のファイルが作成されます。)
cogeotiff dump --image 2 --output output
ビルド
nodeJsのバージョン管理には [n または fnm を使用してください。
# Download the latest nodejs
n latestInstall node deps
npm installBuild everything into /build
npm run buildRun the unit tests
npm run test--- Tranlated By Open Ai Tx | Last indexed: 2026-07-28 ---