geotiffjs / geotiff.js

geotiff.js is a small library to parse TIFF files for visualization or analysis. It is written in pure JavaScript, and is usable in both the browser and node.js applications.
https://geotiffjs.github.io/
MIT License
878 stars 183 forks source link

Set `GeographicTypeGeoKey` in example #328

Closed gpbmike closed 1 year ago

gpbmike commented 2 years ago

Because of the following the writeArrayBuffer example does not work.

https://github.com/geotiffjs/geotiff.js/blob/4f4d116667b6a6aa67c57a91e4a8a6ed3905c0bd/src/geotiffwriter.js#L367-L373

Add GeographicTypeGeoKey for ModelTiepoint to be used.

import { writeArrayBuffer } from 'geotiff';

const values = [1, 2, 3, 4, 5, 6, 7, 8, 9];
const metadata = {
  GeographicTypeGeoKey: 4326,
  height: 3,
  ModelPixelScale: [0.031355, 0.031355, 0],
  ModelTiepoint: [0, 0, 0, 11.331755000000001, 46.268645, 0],
  width: 3
};
const arrayBuffer = await writeArrayBuffer(values, metadata);