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

georaster-stack

v0.5.0

Published

Read Stack of GeoSpatial Raster Data

Downloads

160

Readme

georaster-stack

Read Stack of GeoSpatial Rasters

features

  • Reprojection and Resampling
  • Band Separated Rasters
  • Projection Mixing
  • Turbo-Charging Reprojection
  • Web Workers
  • Simple SRS (inspired by CRS.Simple)
  • Various Resampling Methods

Known Limitations

  • Currently only works in the Browser

install

npm install georaster-stack

basic usage

import { GeoExtent } from "geo-extent";
import { GeoRasterStack } from "georaster-stack/web";

const stack = await GeoRasterStack.init({
  // multiple sources
  // they can even be in different projections!
  sources: [
    "https://example.org/red.tiff",
    "https://example.org/green.tiff",
    "https://example.org/blue.tiff"
  ]
});

const result = await stack.read({
  // instance of GeoExtent (https://www.npmjs.com/package/geo-extent)
  // an extent is a bbox with a spatial reference system
  extent: new GeoExtent([-122.49755859375, 38.8520508, -120.06958007812499, 40.697299008636755], { srs: 4326 }),
  size: [width, height]
});

// result is the following object
{
  // multi-dimensional numberical arrays separated by source, then band, then row, then column
  data: [
    [
      [
        [6453, 7692, 12722, 7274, 6302, 6234, 6147, 6276, ...], // first row of first band
        [5997, 9353, 12493, 6389, 10166, 6285, 10634, 7954, ...] // second row of second band
      ],
      [ ... ] // second band
      [ ... ] // third band
    ],
    [ [ [...] ... ] ... ] // second georaster
    [ [ [...] ... ] ... ] // third georaster
  ],
  size: [ result_data_width, result_data_height ]
}

advanced usage

optional properties

const stack = await GeoRasterStack.init({
  sources: [...],

  // optional properties
  debug_level: 2,
  flat: true, // flatten all the georaster results when reading by one level, so they appear as if they came from the same source
  method: "near-vectorize", // resampling method via https://github.com/danieljdufour/geowarp
  turbo: true // apply experimential projection turbo charging via https://github.com/DanielJDufour/proj-turbo
});

simple projection

If you want to read using pixel coordinates, pass in an extent with srs set to "simple". Inspired by Leaflet's Simple CRS, "simple" srs is when the bottom left corner of the image is [0, 0] and the top-right of the image is [image_width, image_height].

await stack.read({
  extent: new GeoExtent([512, 256, 768, 512], { srs: "simple" }),
  size: [512, 512]
});