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

@cogp/reader

v2.1.4

Published

Cloud Optimized GeoParquet Profile (COGP) reader for the web.

Readme

@cogp/reader

Read Cloud Optimized GeoParquet in a browser using HTTP range requests. Files need geo.lod metadata from the COGP specification.

npm install @cogp/reader

Read a viewport

import { CogpReader, toGeoJSON } from '@cogp/reader';

const reader = await CogpReader.open('https://example.com/data.cogp.parquet');
const batch = await reader.read({
  bbox: [139.4, 35.4, 139.6, 35.6],
  maxLevel: reader.selectLevel(0.001), // CRS units per screen pixel
  columns: [reader.primaryGeometryColumn, 'name'],
  useOverview: true,
});

console.log(batch.length, batch.columns.name);
const features = toGeoJSON(batch);

read() returns a columnar batch. batch.rowIndex identifies each source row; batch.columns contains the requested attributes, and batch.geometry contains the selected geometry. toGeoJSON() creates a FeatureCollection when row objects are useful.

Common options

| Option | Behavior | | --- | --- | | bbox | Keep rows whose bounding boxes intersect [west, south, east, north]. This is a bounding-box filter, not an exact geometry test. | | maxLevel | Include levels through this index. Omit it to read all levels. | | columns | Read only the named columns. Omit it to read the primary geometry and all ordinary attributes. | | useOverview | Use a supported rendering overview. Falls back to primary geometry when the file has no overview; rejects an unsupported overview encoding. | | maxRows | Keep the first matching rows in source order. A limit can omit later spatial matches. | | signal | Cancel a read with an AbortSignal. |

Nested fields use paths such as building.details.height. The reader fetches only that struct field. A map key such as tags.name is selected after reading the map's key and value columns. A list path such as building.floors[1] selects one element after reading the whole list. Results use the requested path as their key in batch.columns.

For a single row's attributes, call reader.readRow(batch.rowIndex[0], { columns: ['id'] }).

Other output formats

import { toGeoArrow, toMvt } from '@cogp/reader';

const mvt = toMvt(batch, { z: 12, x: 3635, y: 1615 });
const arrow = toGeoArrow(batch, { crs: 'OGC:CRS84' });

toMvt() encodes a Mapbox Vector Tile and expects longitude/latitude geometry. Use a tile-sized bbox when reading for a tile. toGeoArrow() writes an Arrow IPC stream; its geometry must contain one geometry family (points, lines, or polygons).

The browser host must allow CORS and HTTP range requests.

A reader caches parsed page indexes (64 MiB) and compressed ranges (32 MiB) by default. To change either budget, pass pageIndexCache or rangeCache to CogpReader.open(). Create a new reader if the file changes at the same URL.

See the browser demo for MapLibre GL JS and deck.gl usage, or use @cogp/maplibre to connect COGP directly to a MapLibre vector source.

Development

pnpm --filter @cogp/reader test