@thi.ng/pixel-io-geotiff
TypeScript icon, indicating that this package has built-in type declarations

0.1.108 • Public • Published

@thi.ng/pixel-io-geotiff

npm version npm downloads Mastodon Follow

[!NOTE] This is one of 199 standalone projects, maintained as part of the @thi.ng/umbrella monorepo and anti-framework.

🚀 Please help me to work full-time on these projects by sponsoring me on GitHub. Thank you! ❤️

About

GeoTIFF reader support for @thi.ng/pixel.

Pseudo-3D DEM visualization using hidden lines plot

This package is only intended to simplify obtaining DEM (elevation) data and not aimed at general GeoTIFF functionality. For the latter we recommend using the wrapped geotiff.js package directly.

Status

STABLE - used in production

Search or submit any issues for this package

Installation

yarn add @thi.ng/pixel-io-geotiff

ESM import:

import * as geo from "@thi.ng/pixel-io-geotiff";

Browser ESM import:

<script type="module" src="https://esm.run/@thi.ng/pixel-io-geotiff"></script>

JSDelivr documentation

For Node.js REPL:

const geo = await import("@thi.ng/pixel-io-geotiff");

Package sizes (brotli'd, pre-treeshake): ESM: 399 bytes

Dependencies

Note: @thi.ng/api is in most cases a type-only import (not used at runtime)

API

Generated API docs

import { GRAY16 } from "@thi.ng/pixel";
import { readGeoTiff } from "@thi.ng/pixel-io-geotiff";
import { asPGM16 } from "@thi.ng/pixel-io-netpbm";
import { readFileSync } "node:fs";

// load GeoTIFF image and convert to thi.ng/pixel floatBuffer
// the result image uses a custom pixel format (FLOAT_GRAY_RANGE, with [min..max]
// set to the analyzed value range found in the source image raster...)
const result = await readGeoTiff(readFileSync("USGS_1_n37w119_20211004.tif"));
// { img: FloatBuffer { size: [ 3612, 3612 ], ... }, tiff: { ... } }

// convert to 16bit PGM
writeFileSync("n37w119.pgm", asPGM16(result.img.as(GRAY16)));

// the result also contains the original TIFF image
// (see 3rd party geotiff package for more details)
result.tiff.getGDALMetadata(0);
// {
//   LAYER_TYPE: '*',
//   RepresentationType: '*',
//   STATISTICS_MAXIMUM: '4412.8549804688',
//   STATISTICS_MEAN: '2114.5010480446',
//   STATISTICS_MINIMUM: '140.41374206543',
//   STATISTICS_STDDEV: '918.91201914189',
//   STATISTICS_VALID_PERCENT: '100'
// }

Authors

If this project contributes to an academic publication, please cite it as:

@misc{thing-pixel-io-geotiff,
  title = "@thi.ng/pixel-io-geotiff",
  author = "Karsten Schmidt",
  note = "https://thi.ng/pixel-io-geotiff",
  year = 2023
}

License

© 2023 - 2024 Karsten Schmidt // Apache License 2.0

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
0.1.1086latest

Version History

VersionDownloads (Last 7 Days)Published
0.1.1086
0.1.1071
0.1.1060
0.1.1050
0.1.1040
0.1.1030
0.1.1020
0.1.1010
0.1.1000
0.1.990
0.1.980
0.1.970
0.1.960
0.1.950
0.1.940
0.1.930
0.1.920
0.1.910
0.1.900
0.1.893
0.1.880
0.1.870
0.1.860
0.1.850
0.1.840
0.1.830
0.1.820
0.1.810
0.1.800
0.1.790
0.1.780
0.1.770
0.1.760
0.1.750
0.1.740
0.1.730
0.1.720
0.1.710
0.1.700
0.1.690
0.1.680
0.1.670
0.1.660
0.1.650
0.1.640
0.1.630
0.1.620
0.1.610
0.1.590
0.1.580
0.1.570
0.1.560
0.1.550
0.1.540
0.1.530
0.1.524
0.1.510
0.1.500
0.1.490
0.1.480
0.1.470
0.1.461
0.1.446
0.1.430
0.1.420
0.1.410
0.1.400
0.1.390
0.1.380
0.1.370
0.1.360
0.1.350
0.1.340
0.1.330
0.1.320
0.1.310
0.1.300
0.1.290
0.1.280
0.1.270
0.1.260
0.1.250
0.1.240
0.1.230
0.1.210
0.1.200
0.1.190
0.1.180
0.1.170
0.1.160
0.1.150
0.1.140
0.1.130
0.1.120
0.1.110
0.1.100
0.1.90
0.1.80
0.1.70
0.1.60
0.1.50
0.1.40
0.1.30
0.1.11
0.1.00

Package Sidebar

Install

npm i @thi.ng/pixel-io-geotiff

Weekly Downloads

19

Version

0.1.108

License

Apache-2.0

Unpacked Size

21.5 kB

Total Files

8

Last publish

Collaborators

  • thi.ng