Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Socket
Sign inDemoInstall

geotiff

Package Overview
Dependencies
Maintainers
3
Versions
49
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

geotiff

GeoTIFF image decoding in JavaScript


Version published
Weekly downloads
178K
decreased by-18.62%
Maintainers
3
Weekly downloads
 
Created

What is geotiff?

The 'geotiff' npm package is a JavaScript library for reading and writing GeoTIFF files. It provides a range of functionalities for handling geospatial data stored in the TIFF format, including parsing metadata, extracting image data, and handling various compression methods.

What are geotiff's main functionalities?

Reading GeoTIFF files

This feature allows you to read GeoTIFF files from a URL. The code sample demonstrates how to load a GeoTIFF file, extract image dimensions, and read raster data.

const GeoTIFF = require('geotiff');

async function readGeoTIFF(url) {
  const tiff = await GeoTIFF.fromUrl(url);
  const image = await tiff.getImage();
  const width = image.getWidth();
  const height = image.getHeight();
  const data = await image.readRasters();
  console.log(`Width: ${width}, Height: ${height}`);
  console.log(data);
}

readGeoTIFF('path/to/your/geotiff/file.tif');

Writing GeoTIFF files

This feature allows you to write GeoTIFF files. The code sample demonstrates how to create a GeoTIFF file from an array buffer with specified image dimensions and properties.

const GeoTIFF = require('geotiff');

async function writeGeoTIFF() {
  const data = new Uint8Array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]);
  const tiff = await GeoTIFF.writeArrayBuffer(data, {
    width: 2,
    height: 5,
    samplesPerPixel: 1,
    bitsPerSample: 8,
    compression: 'none'
  });
  console.log(tiff);
}

writeGeoTIFF();

Parsing metadata

This feature allows you to parse metadata from a GeoTIFF file. The code sample demonstrates how to load a GeoTIFF file and extract its metadata.

const GeoTIFF = require('geotiff');

async function parseMetadata(url) {
  const tiff = await GeoTIFF.fromUrl(url);
  const image = await tiff.getImage();
  const metadata = image.getFileDirectory();
  console.log(metadata);
}

parseMetadata('path/to/your/geotiff/file.tif');

Other packages similar to geotiff

Keywords

FAQs

Package last updated on 02 Apr 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc