Web Analytics

cogeotiff

⭐ 111 stars French by blacha

cogeotiff

Outils pour travailler avec Cloud optimized GeoTIFF (COG)

Utilisation

Charger un COG depuis une URL en utilisant fetch

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. } */

Interface en ligne de commande

npm i -g @cogeotiff/cli

info cogeotiff

Afficher les informations de base sur le COG

cogeotiff info webp.cog.tif
Sortie :

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

vidage cogeotiff

Vidage de toutes les tuiles pour une image (Attention si vous faites cela pour un gros cog, cela créera des millions de fichiers.)

cogeotiff dump --image 2 --output output

Compilation

Nécessite NodeJs >=24.0

Utilisez n ou fnm pour gérer les versions de NodeJs

# Download the latest nodejs
n latest

Install node deps

npm install

Build everything into /build

npm run build

Run the unit tests

npm run test

--- Tranlated By Open Ai Tx | Last indexed: 2026-07-28 ---