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

threetiles

v0.1.1

Published

Geo-spatial terrain streaming engine for three.js

Readme

Threetiles is a 3D geospatial engine 🌎 for three.js — a TypeScript port of bevytiles (itself a port of the raytiles C++ engine). It streams satellite imagery, Terrarium heightmaps, and normal maps around a moving camera and renders them as GPU-displaced terrain, letting you visualize any location on Earth in the browser.

It provides precise, ground-truth altitude data (terrain.groundHeight) for collision detection, spawning, and topographical analysis.

Run the demo

npm install
npm run dev          # opens the Vite dev server

Flies over the Grand Canyon. A/D roll, Q/E yaw, W/S pitch, +/- throttle, R reset after crashing into the terrain. Tiles come straight from the providers via fetch (the browser's HTTP cache applies; Esri imagery serves JPEG despite the endpoint name — decoding handles both).

npm run build produces a static, deployable bundle of the demo in dist-demo/.

Use as a library

npm install threetiles three
import * as THREE from 'three';
import { Terrain, initialPosition, worldFromLatLon } from 'threetiles';

const scene = new THREE.Scene();
const camera = new THREE.PerspectiveCamera(60, 1, 1, 400_000);
const terrain = new Terrain(camera, { world: worldFromLatLon(46.206889, 9.497194) }, scene); // the Dolomites
camera.position.copy(initialPosition(terrain.world, 5000));

function frame() {
  terrain.update();            // reconcile → promote → update-desired → status
  renderer.render(scene, camera);
  requestAnimationFrame(frame);
}

Configuration mirrors bevytiles: WorldConfig, StreamingConfig, RenderingConfig (runtime mutable — mutate terrain.rendering and the engine syncs materials), NetworkConfig (concurrency replaces worker threads). world.maxZoom defaults to 15; raising it (≤ 22) opts into heightmaps synthesized from the native-zoom ancestors and flat default normals. Large worlds use the rebase convention via terrain.anchor / terrain.rebase(shift) (absolute = user − worldOffset); see the demo's rebaseLargeWorld.

Layout

| module | role | |------------------------|--------------------------------------------------------------------------------------------------------| | src/lod.ts | pure desired-set policy (snapshot-tested — values match the C++ and Rust engines exactly) | | src/source.ts | tile fetching: fetch with a concurrency cap + memory cache of native heightmaps; decode + synthesis | | src/terrain.ts | the engine: reconcile / promote / updateDesired / status; one mesh per tile | | src/material.ts | ShaderMaterial + GLSL: displacement, lighting, fog | | src/synth.ts | Terrarium float decode / quadrant upsample / carry-safe encode | | src/height.ts | uint16 height grids + bilinear groundHeight |

Notes

  • Data: imagery © Esri; elevation/normals from the Mapzen/AWS terrain tiles. Mind their terms. Custom providers must send permissive CORS headers.
  • npm test runs the offline suite (lod snapshots, synthesis math, height grids).
  • Requires WebGL2 (three.js r163+).

Releasing

Releases are automated with release-please: merge Conventional Commits to main, release-please opens/updates a release PR (version bump + CHANGELOG.md), and merging that PR tags a GitHub release and publishes the package to npm with provenance (.github/workflows/release-please.yml). Publishing uses npm trusted publishing (OIDC); set the repo up as a trusted publisher for threetiles on npmjs.com, or add an NPM_TOKEN secret and wire it in the workflow.

License

  • Apache License, Version 2.0 (LICENSE-APACHE or https://www.apache.org/licenses/LICENSE-2.0)
  • MIT license (LICENSE-MIT or https://opensource.org/licenses/MIT)