npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

geotiff-tile-web-worker

v0.11.0

Published

Create a GeoTIFF Tile using an Inline Web Worker

Downloads

165

Readme

geotiff-tile-web-worker

Create a GeoTIFF Tile using an Inline Web Worker

install

via script tag

<script src="https://unpkg.com/geotiff-tile-web-worker"></script>

via terminal

npm install geotiff-tile-web-worker

basic usage

import { createWorker } from "geotiff-tile-web-worker";

const worker = createWorker();

const result = await worker.createTile({
  // url to a geotiff
  url: "https://storage.googleapis.com/pdd-stac/disasters/hurricane-harvey/0831/20170831_172754_101c_3b_Visual.tif",

  // bounding box of tile in format [xmin, ymin, xmax, ymax]
  bbox: [-95.976562, 29.535232, -95.888671, 29.611673]
});

// result is
{
  height: 256,
  width: 256,
  tile: [
    Uint8Array[...], // first band
    Uint8Array[...], // second band
    Uint8Array[...], // third band
  ]
}

advanced usage

import { createWorker } from "geotiff-tile-web-worker";

const worker = createWorker();

worker.createTile({
  // url to a GeoTIFF file
  url: "https://storage.googleapis.com/pdd-stac/disasters/hurricane-harvey/0831/20170831_172754_101c_3b_Visual.tif",

  // bounding box of tile in format [xmin, ymin, xmax, ymax]
  bbox: [-96.01226806640625, 29.616445727622548, -96.01089477539062, 29.61763959537609],

  /*** ALL PARAMETERS BELOW ARE OPTIONAL */

  // spatial reference system of the bounding box as an EPSG Code number
  // default is 4326
  bbox_srs: 4326,

  // geometry to clip by in GeoJSON format
  cutline: geojson,

  // spatial reference system of cutline
  // default is 4326
  cutline_srs: 4326,

  // set to higher number to increase logging
  // default is 0
  debug_level: 0,

  // over-ride no data value set in geotiff metadata
  geotiff_no_data: 0,

  // resampling method
  // default is "near"
  method: "max",

  // round pixel values to integers
  // default is false
  round: true,

  // override default nested tile array types
  tile_array_types: ["Array", "Uint8ClampedArray"],

  // if tile_array_types is not specified, choose the strategy for deciding which type of arrays:
  // auto - safest and default option, only uses typed array if it's sure there won't be any clamping
  // geotiff - use the same array types that geotiff.js uses (good if not stretching min or max)
  // untyped - use only untyped arrays
  // undefined - same as auto
  tile_array_types_strategy: "untyped",

  // layout using xdim layout syntax: https://github.com/danieljdufour/xdim
  tile_layout: "[band][row,column]",

  // projection of the tile as an EPSG code
  // default is 3857
  tile_srs: 3857,

  // tile height in pixel
  // default is 256
  tile_height: 512,

  // over-ride default "no data" value in output tile
  tile_no_data: 0,

  // width of tile in pixels
  // default is 256
  tile_width: 512,

  // whether to use overviews if available
  // default is true
  use_overview: false,

  // enable experimental turbocharging via proj-turbo
  // default is false
  turbo: false
})

// stop web worker
worker.terminate();