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

leaflet-city-mapper

v0.0.4

Published

A small 3D rendering engine for leaflet

Readme

leaflet-city-mapper

NPM version License

Your data, on a rotated and pitched Leaflet map: a small 3D rendering engine (WebGPU) packaged onto standard L.Layer. Available sources: extruded GeoJSON, glTF models, raster PMTiles, COG and terrain layers.

For a working example see one of the following demos:

How to use

Just load Leaflet before this plugin:

<link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/leaflet.css">
<script src="https://unpkg.com/[email protected]/dist/leaflet.js"></script>
<script src="https://unpkg.com/[email protected]/dist/leaflet-city-mapper.js"></script>

And then create a native L.Layer:

new L.Layer({ source: { /* source options */ } })

For example, here is how you can load a geojson object:

const buildings = new L.Layer({
  source: {
    type: 'geojson',
    data: GeoJSON,
    style: ({ properties }) => ({ top: properties.height, color: properties.color }),
    tooltip: ({ properties }) => `${properties.name}: ${properties.height} m`,
    roofTexture: true,
    wallTexture: 0.75,
  },
}).addTo(map);

Time and walk controls

The walk camera follows vertical ascent and descent as well as horizontal movement. Releasing Space lets the walker land on loaded building roofs; walking off an edge resumes falling toward the terrain or the next roof below.

const time = new L.Control.Time({ position: 'bottomright' }).layer.addTo(map);
const walk = new L.Control.Walk({ speed: 6, distance: 20 }).addTo(map);

Update demo data

The examples makes extensive use of PMTiles to ensure offline access / long-term availability of the maps. To update them:

npm run pmtiles
node build/pmtiles.js --only=trees
node build/pmtiles.js --only=colosseum
node build/pmtiles.js --jobs=6
node build/pmtiles.js --self-test

Paris archives use the buildings bbox (default: 2.26,48.835,2.38,48.885). Use --bbox=west,south,east,north to override it.

Build Guide

Within your local development environment:

git clone [email protected]:Raruto/leaflet-city-mapper.git
cd ./leaflet-city-mapper

npm i         # install dependencies
npm run dev   # start dev server at: http://localhost:8080
npm run build # generate "dist" bundles and minified "libs" files (once)
npm run test  # build and run browser tests

After that you can start developing inside the src folder (eg. open "http://localhost:8080/examples" in your browser to preview changes).

Source layout

src/
  index.js           Public entry point and source registration
  globals/           One shared constant or mutable cell per module
  camera/            Camera API, projection and animation
  controls/          Compass, dragging, touch and resizing
  core/              Leaflet layer integration, events, mutations and overlays
  scene/             Source routing, lifecycle, graph nodes and transforms
  sources/           GeoJSON and streamed source geometry
  picking/           Raycasting, highlighting and feature interaction
  rendering/         Frame stages, roof atlases, pipelines, meshes and textures
  shadows/           Directional shadow maps, bounds and cache
  lighting/          Point lights and spatial light grids
  shaders/           Material shader generation
  geometry/          Trees, lights, bridges, primitives and Leaflet vector geometry
  triangulation/     Polygon triangulation and ring operations
  collision/         Mesh intersection and collision queries
  models/            glTF loading, decoding and materials
  archives/          PMTiles archive reading and decompression
  cog/               Supported GeoTIFF directories, byte ranges and tile decoding
  raster/            Raster tile loading, attachment and lifecycle
  traffic/           Routes, scheduling, simulation, loading and rendering
  vehicles/          Vehicle model geometry
  terrain/           Terrain loading and sampling
  sunlight/          Sun, moon, sky and time controls
  walk/              First-person walking
  utils/             Shared colour and numeric helpers

Compatibile with: Leaflet 1.9.4 compatible! Leaflet 2.x compatible!