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

maplibre-gl-panoramax

v0.4.0

Published

Panoramax for MapLibre GL JS: browse the federated street-level imagery catalog (STAC client, map layers, tiled-HD configs) and write corrections back (pose/position PATCH, token claim flow). Pairs with maplibre-gl-photosphere for immersive viewing/editin

Readme

maplibre-gl-panoramax

Panoramax for MapLibre GL JS: browse the federated street-level imagery catalog and write corrections back — from the browser, front-end only.

Pairs with maplibre-gl-photosphere for immersive 360° viewing and pose editing: this package knows the Panoramax API, that one knows the rendering — together they are a complete street-view stack on open data. Proven in production by MapMax.

npm install maplibre-gl-panoramax

What's inside

Catalog client (client.js) — reads default to the federated meta-catalog (api.panoramax.xyz); every function takes an apiBase override for single-instance deployments:

import {addPanoramaxLayers, onPictureClick, getPicture, getSequence, searchNearby} from 'maplibre-gl-panoramax';

addPanoramaxLayers(map);                  // coverage: sequence lines + clickable dots
onPictureClick(map, async (id) => {
  const pic = await getPicture(id);       // normalized: type, heading, assets,
  // pic.homeApi                          //   the OWNING instance (for edits),
  // pic.tiles                            //   tiled-HD config for progressive viewers
});

normalizeItem() flattens a STAC feature into {id, lon, lat, heading, type, sequenceId, assets, homeApi, exifPose, tiles, …}type is equirectangular only on authoritative 360° metadata (a 2:1 ratio alone is a flat wide frame). tilesFromStac() / fetchTilesConfig() produce the tiles option of maplibre-gl-photosphere's progressive HD refinement (note: the meta-catalog strips tiled-asset fields from /search; fetchTilesConfig recovers them).

Edit write-back (edit.js) — the Panoramax API can PATCH a picture's pose (pitch/roll/yaw, v2.14.0) and position (lat/lon, v2.8.0) on its home instance (the read-only meta-catalog answers 405 — homeApi handles that):

import {posePatchRequest} from 'maplibre-gl-panoramax';

const req = posePatchRequest(pic.homeApi, pic.sequenceId, pic.id,
    {pitch: -2, roll: 1.5, yaw: 180},          // yaw = offset from the GPS direction
    token,
    {latitude, longitude});                    // optional corrected position
await fetch(req.url, req.init);                // fixed at the source, for every viewer

Sign-in (auth.js) — the browser token claim flow (generate → the user signs in on the instance via OpenStreetMap → poll until claimed):

import {tokenGenerateRequest, parseGeneratedToken, whoAmIRequest, claimPollDelays} from 'maplibre-gl-panoramax';

const gen = tokenGenerateRequest(pic.homeApi, 'My app');
const {jwt, claimUrl} = parseGeneratedToken(await (await fetch(gen.url, gen.init)).json());
window.open(claimUrl, '_blank');               // OSM sign-in happens there
for (const delay of claimPollDelays()) {       // 200 on users/me = connected
  await new Promise((r) => setTimeout(r, delay));
  const who = whoAmIRequest(pic.homeApi, jwt);
  if ((await fetch(who.url, who.init)).ok) break;
}

Everything is a pure request builder/parser — the caller owns fetch, tabs and token storage (keep tokens in sessionStorage, per instance).

Coverage filters & themes (coverage.js) — narrow the map to what you care about, colour by capture age:

import {setCoverageFilter, applyCoverageTheme} from 'maplibre-gl-panoramax';

setCoverageFilter(map, {type: 'equirectangular', from: '2024-01-01'});
setCoverageFilter(map, {collection: sequenceId});   // one sequence only
setCoverageFilter(map, {});                         // clear
applyCoverageTheme(map, 'age');                     // colour = capture year

Federation (federation.js) — the whole federated network, not just the meta-catalog:

import {getInstances, instanceForPicture} from 'maplibre-gl-panoramax';

const instances = await getInstances();          // every harvested instance
const home = instanceForPicture(pic, instances); // where edits/sign-in go
// home.name, home.apiBase, home.authEnabled → label your "Connect" button

Street-view navigation (nav.js) — from a picture to the walkable set, ready for maplibre-gl-photosphere:

import {getPicture, navigationSet, viewerTarget, fetchTilesConfig} from 'maplibre-gl-panoramax';

const pic = await getPicture(id);
photosphere.enter({...viewerTarget(pic), tiles: pic.tiles ?? await fetchTilesConfig(pic)});

const targets = await navigationSet(pic);        // one nearby search
photosphere.setNavArrows(targets.slice(0, 2).map((t) => ({bearing: t.bearingDeg, id: t.pic.id})));
photosphere.setNavPois(targets.map((t) => ({east: t.east, north: t.north, id: t.pic.id})));
// on groundPick(px, py) → id: photosphere.goTo(targets.find(...).target)

Each entry carries relation (next/prev from the sequence links — always offered; sequence/nearby only within maxDistanceM), ground offsets in metres, bearing, distance, and the ready target. Pure selection (navTargets) and geometry (offsetMeters, bearingBetween) are exported for offline use and testing.

Tests

podman compose run --rm test    # vitest, containerized (see RULES.md)

License

BSD-3-Clause. Imagery: served by Panoramax instances under their own licenses.