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 🙏

© 2025 – Pkg Stats / Ryan Hefner

rgisf

v1.0.34-alpha

Published

Raster GIS file format

Downloads

63

Readme

Rgisf

Custom GIS raster format and utilities for WebGIS

Rgisf is a npm package for loading and rendering GIS raster data.

Features

  • Adding custom renderers for a raster image/its bands
  • Render and save raster images
  • Generate a specific tile with the renderer
  • Generate and cache tiles at various zoom levels

Installation

You can install rgisf using npm:

npm install rgisf

Usage

Import the package:

    const Rgf = require('rgisf');

Loading data

  • From rgisf file

a) Buffer:

    const rgf = new Rgf(buffer);

b) From file:

    const rgf = await Rgf.fromFile(path);

c) From url:

    const rgf = await Rgf.fromUrl(url);
  • From geotiff file

Note: Currently, geotiff npm package is being used for loading and parsing geotiff data. a) From file:

    const rgf = await Rgf.fromGeoTiffFile(path);

b) From url:

    const rgf = await Rgf.fromGeoTiffUrl(url);

Updating renderer

  • Setting renderer

const renderer = {
    type: 1, //Renderer.STRETCHED
    definition: {
        colorRamp: [[0, 0, 0, 255], [255, 255, 255, 255]]
    }
}
rgf.setRenderer(renderer)

Currently, it supports two types of renderers: 1) Stretched 2) Classified

  • Stretched renderer

Eg:

        {
            type: 1, //Renderer.STRETCHED
            definition: {
                colorRamp: [
                    [0, 0, 0, 255],//[r,g,b,a]
                    [255, 255, 255, 255]
                ]
            }
        }
   

You can add more colors to the color ramp array. It will be split at equal interval and applied across on the raster file.

  • Classified renderer

Eg:

        {
            type: 2, //Renderer.CLASSIFIED
            definition: {
                classes: [
                    {
                        min: 0,
                        max: 50,
                        color: [255, 16, 100, 255]
                    },
                    {
                        min: 50,
                        max: 75,
                        color: [255, 16, 16, 255]
                    },
                    {
                        min: 75,
                        max: 80,
                        color: [163, 19, 75, 255]
                    }
                ]
            }
        }
   

Here, you can specify the color for the class and the range of value(min & max). Unspecified values(within any ranges) will be transparent.

Rendering

All the rendering related outputs will have the applied renderer. To get rendered datauri,

const img = rgf.toDataUrl()

To save it as a PNG,

await rgf.saveAsPng(path)

To get specfic tile for the given x, y, z

const canvas = await rgf.getTileImage();
const dataUrl = canvas.toDataURL();

To save a specific tile as PNG,

await rgf.saveTileAsPng(path);

To generate and save tiles for specified zoom levels,

const z1 = 5;
const z2 = 12;
await rgf.generateTiles(z1, z2, tileCacheDir);