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

tilerama

v0.1.1

Published

Tilerama: A Node.js library for acquiring, constructing, analyzing, and visualizing complex street networks

Readme

Tilerama

npm types license

Tilerama screenshot

A TypeScript-first toolkit for downloading, cleaning, routing, and plotting OpenStreetMap street networks with graphology.

Inspired by OSMnx but built for the Node.js ecosystem.

Highlights

  • Fetch networks from Overpass via bbox, center+distance, address/place name (Nominatim), GeoJSON polygon, or local OSM XML.
  • Returns a graphology MultiDirectedGraph with OSM tags, edge lengths, CRS metadata, and helpers to keep the largest component.
  • Built-in simplification and truncation to clip networks to bboxes or polygons.
  • Conversion + validation helpers: GeoJSON/GDF, GraphML-like, projections, and geometry utilities.
  • Routing and analysis: Dijkstra shortest paths, implicit speed handling, stats (lengths, intersections, circuity).
  • Visualization: quick Leaflet HTML plotter and color helpers for nodes/edges.
  • Sensible defaults for caching, rate limiting, headers, and user-agent etiquette.

Release notes

  • 0.1.1
    • Added graph_from_pbf for offline graph builds directly from local .osm.pbf files (roads/rails, oneway handling, optional bbox clip).
    • New low-level OSM helpers: pbf parser utilities, osm_tags (road/rail tag sets, default oneway), and polyline helpers (simplify_polyline, dedup_close_points, shape_signature).
    • tsconfig now targets ES2020 with DOM libs for broader runtime support.

Install

npm install tilerama

Quickstart

1) Download a network (bbox)

BBox order is [north, south, east, west].

import { graph_from_bbox } from "tilerama";

const bbox: [number, number, number, number] = [
  37.80,  // north
  37.78,  // south
  -122.40, // east
  -122.43  // west
];

const G = await graph_from_bbox(bbox, "drive", true);
console.log(G.order, G.size);

2) From a place name + optional trimming

import { graph_from_place, truncate_graph_bbox, largest_component } from "tilerama";

const G2 = await graph_from_place("Lisbon, Portugal", 1, "drive"); // which_result=1 → first geocoder match
const clipped = truncate_graph_bbox(G2, bbox, true);
const giant = largest_component(clipped);

3) Convert to GeoJSON and plot

import { graph_to_geojson, plot_graph } from "tilerama";

const { nodes, edges } = graph_to_geojson(giant);
const htmlPath = plot_graph(giant, { filepath: "network.html" });
console.log(nodes.features.length, edges.features.length, htmlPath);

4) Route between two nodes

import { shortest_path } from "tilerama";

const [origin, destination] = giant.nodes().slice(0, 2);
const path = shortest_path(giant, origin, destination, "length");

API at a glance

All functions are exported from src/index.ts.

  • Graph construction: graph_from_bbox, graph_from_point, graph_from_address, graph_from_place, graph_from_polygon, graph_from_xml, _create_graph.
  • Cleanup & trimming: simplify_graph, truncate_graph_bbox, truncate_graph_polygon, largest_component, get_largest_component.
  • Conversion & validation: graph_to_geojson, graph_to_gdfs, graph_from_gdfs, validate_graph, validate_node_edge_gdfs, validate_features_gdf, to_digraph, to_undirected.
  • Routing & analysis: shortest_path, add_edge_speeds, add_edge_travel_times, basic_stats, count_streets_per_node, edge_length_total, intersection_count, circuity_avg.
  • Utilities: distance/bearing (great_circle, haversine), projection helpers, Overpass/Nominatim helpers, geometry utils, color helpers (get_colors, get_node_colors_by_attr, get_edge_colors_by_attr), interactive plotting (plot_graph).

Configuration

Tilerama exposes a mutable settings object.

import { settings } from "tilerama";

settings.use_cache = true;
settings.cache_folder = "./cache";
settings.overpass_rate_limit = true;
settings.overpass_url = "https://overpass.kumi.systems/api";
settings.http_user_agent = "MyCoolApp ([email protected])";

Key toggles:

  • use_cache, cache_folder
  • overpass_url, overpass_rate_limit, overpass_memory
  • http_user_agent, http_referer, http_accept_language
  • requests_timeout
  • bidirectional_network_types, all_oneway

Development

npm install
npm run build

Outputs are written to dist/. Published files include dist/, README.md, and package.json.

Data sources & etiquette

Tilerama talks to public Overpass and Nominatim endpoints by default. Please:

  • Keep overpass_rate_limit enabled and set a descriptive User-Agent/Referer.
  • Avoid abusive request patterns; cache when you can.
  • Respect OpenStreetMap, Overpass, and Nominatim usage policies.

License

MIT