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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@icgcat/layer-types

v0.0.13

Published

Layer-types is a library to integrate geospatial data supporting FGB, WMS, PMTiles, Raster COG.

Readme

License Version LinkedIn

@icgcat/layer-types

Introduction

@icgcat/layer-types is a JavaScript package that simplifies integrating geospatial data into a Map library, supporting FlatGeobuf (FGB), WMS, PMTiles, and Raster COG file formats. It handles vector and raster tiles, offering easy customization for styling and layer rendering.


Installation

To install the package, use npm or yarn:

npm install @icgcat/layer-types

Usage

Import and Basic Example

Here's how to use the stats functions in your application:

<script>

import { getSrcLayerFromFGB } from '@layer-types/layer-types';
const fgbLayer = getSrcLayerFromFGB("https://tilemaps.icgc.cat/vector/fgb/arees_hidrogeologiques_aquifers_vigent.fgb", 'aquifers_fgb');

</script>

Component Functions

getSrcLayerFromFGB(url, idLayer) ⇒ Promise.<Object>

Fetches a FlatGeobuf (FGB) file and converts its contents into a Map layer, based on the geometry type of the features within the file. The layer is created using the provided layer ID. The resulting layer can be used in a MapLibre map.

Kind: global function
Returns: Promise.<Object> - A promise that resolves to an object containing sourceContent and layerContent.
Throws:

  • Error Throws an error if the geometry type cannot be determined from the features in the file.

| Param | Type | Description | | --- | --- | --- | | url | string | The URL of the FlatGeobuf (FGB) file to be fetched. | | idLayer | string | The ID to be used for the source and layer in the map. |

Example

const fgbLayer = await getSrcLayerFromFGB("https://example.com/data.fgb", "myLayer");

getSrcLayerFromWMS(url, idLayer) ⇒ Object

Creates a Map layer from a WMS (Web Map Service) source using the provided URL and layer ID.

Kind: global function
Returns: Object - An object containing sourceContent and layerContent.

| Param | Type | Description | | --- | --- | --- | | url | string | Base URL of the WMS service, which may include a placeholder for {bbox-epsg-3857} that will be replaced dynamically. | | idLayer | string | The ID to be used for the source and layer in the map. |

Example

const wmsLayer = getSrcLayerFromWMS("https://example.com/wms?service=WMS&request=GetMap&version=1.1.1&layers={layer}&format=image/png&transparent=true&width=512&height=512&srs=EPSG:3857&bbox={bbox-epsg-3857}", "myWmsLayer");

getSrcLayerFromPMTiles(url, idLayer) ⇒ Object

Converts a PMTiles file into a Map layer based on its content type (vector or raster). Supports both vector and raster tiles within the PMTiles format.

Kind: global function
Returns: Object - An object containing sourceContent and layerContent.

| Param | Type | Description | | --- | --- | --- | | url | string | URL of the PMTiles file to be fetched. | | idLayer | string | The ID to be used for the source and layers in the map. |

Example

const pmtilesLayer = await getSrcLayerFromPMTiles("https://example.com/tiles.pmtiles", "myPmtilesLayer");

getSrcLayerFromCOG(url, idLayer) ⇒ Object

Converts a Cloud Optimized GeoTIFF (COG) into a Map raster layer. Supports optional customization of layer properties using the provided idLayer.

Kind: global function
Returns: Object - An object containing sourceContent and layerContent.

| Param | Type | Description | | --- | --- | --- | | url | string | URL of the Raster COG file to be fetched. | | idLayer | string | The ID to be used for the source and layer in the map. |

Example

const cogLayer = getSrcLayerFromCOG("https://example.com/image.tif", "myCogLayer");

Dependencies

@icgc/stats integrates the following libraries:

  • pmtiles
  • flatgeobuf
  • cogProtocol
  • maplibre-gl

Developed by:

License

This project is licensed under the MIT License.