geotiff.js is a robust JavaScript library designed for decoding GeoTIFF and TIFF images in both browser and Node.js environments. It enables developers to read and parse these file formats, extract raw raster data across various data types and compressions (including Packbits, LZW, Deflate, JPEG, LERC, Zstandard, and WebP), and access rich geospatial metadata like GeoKeys and TIFF tags. The current stable version is 3.0.5, with ongoing active development and regular patch releases, alongside beta versions (e.g., 3.1.0-beta.0) that introduce new features like multi-stripped and tiled writing support. Key differentiators include its pure JavaScript implementation, configurable worker pools for efficient decoding, and selective reading of file portions to optimize bandwidth, making it an essential tool for web-based GIS applications that require client-side processing of georeferenced imagery.
npm install geotiffVerified import paths — ran on the pinned version, not inferred.
Demonstrates how to asynchronously load a GeoTIFF from a URL, access its primary image, read raster data from its bands, and retrieve geospatial metadata like GeoKeys and the bounding box.
Review the v2 to v3 migration guide for specific API changes related to tag access, `getTiePoints()`, `getGDALMetadata()`, and `fileDirectory` properties. Ensure tag access is asynchronous where necessary.
Migrate your import statements to use ES module `import` syntax (`import { Name } from 'geotiff'`). Ensure your Node.js project is configured to treat `.js` files as ESM (e.g., by setting `"type": "module"` in `package.json` or using `.mjs` file extensions).Ensure you are using the latest patch release within your major version (e.g., 3.0.5 or a stable 3.1.x) to benefit from fixes related to source blocking and slicing. Report any issues with specific GeoTIFF files or custom sources to the maintainers.
Ensure your Node.js environment is `node>=16.x` and your `tsconfig.json` (if applicable) uses `"moduleResolution": "node16"` or `"bundler"` to align with the package's intended module resolution strategy.
Be prepared to write custom logic for advanced geospatial transformations and querying using the raw raster data and GeoKey metadata provided by the library. Consider using helper libraries like `geotiff-geokeys-to-proj4` if re-projection is a common requirement.
Convert your Node.js project or the specific file to use ES Modules with `import` statements and ensure `"type": "module"` is set in your `package.json`, or use an explicit `.mjs` extension.
Update `geotiff.js` to the latest patch release (e.g., 3.0.5 or 3.1.0-beta.0+) which includes fixes for these types of issues. If the problem persists, ensure your data source is correctly implemented if it's custom, or share the problematic GeoTIFF file with the maintainers for debugging.
Use the `getTags()` method and await its result, or consult the `GeoTIFFImage` API for the correct asynchronous access pattern for the specific tag you need.
Ensure you are using type imports (`import type { GeoTIFFImage }`) only for type declarations, and not attempting to instantiate them as values. Verify the function signatures for the methods you are calling and provide arguments of the correct type.No dependency data recorded yet.