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

strava-tiles

v0.1.1

Published

Compute the map tiles covered by your Strava activities, and draw them as images

Readme

Npm Build Status Coverage Downloads PRs welcome MIT license Sponsor


strava-tiles computes the map tiles covered by your Strava activities, like the explorer maps do, and draws an activity as an image.

It powers gatsby-strava-tiles, and it works without Gatsby too, for any static site generator or script. It reads the activities and routes that strava-sync stores.

All the x/y pairs are slippy map tile coordinates at zoom level 14.

Installation

npm install strava-tiles

Node 22.12 or later is required. The package is an ES module, which require() loads too, and it comes with its TypeScript types.

Command line

npx strava-tiles                      # .strava to tiles.json
npx strava-tiles --store .strava --out public/tiles.json --routes

It writes an object with the tiles of each activity by id (activities), the coverage of the athlete (athlete) and the tiles of each route by id (routes, with --routes). Run it with --help to list its options.

Usage

import {createFileStore} from "strava-sync"
import {computeTiles, consoleLogger, readRoutes} from "strava-tiles"

const store = createFileStore({dir: ".strava"})

const {activityTiles, athleteTiles, routeTiles} = computeTiles({
  activities: await store.readActivities(),
  routes: await readRoutes(store),
  logger: consoleLogger,
})

activityTiles.get(activityId) // [{x, y}, ...], the tiles it was the first to cover
athleteTiles.parts.square // the largest fully covered square
routeTiles.get(routeId) // {all, new}

An activity is any object with an id, a start_date and coordinates, a list of [lng, lat] points, which is what strava-sync stores. A raw latlng stream in its streams makes a gap of more than 10 km a GPS pause, whose tiles do not count.

| Function | What it does | | ----------------------------------------- | -------------------------------------------------------------------------------------------------------- | | computeTiles({activities, routes, ...}) | {activityTiles, athleteTiles, routeTiles, coveredTiles}, the maps being keyed by id | | readRoutes(store) | The routes of a strava-sync store with their coordinates | | getActivityTiles(activity, allTiles) | The tiles of an activity that allTiles does not hold | | getAthleteTiles(tiles, tilesByMonth) | The coverage of the athlete: square, cluster, rest, row, column and outlines, overall and month by month | | getRouteTiles(route, isNewTile) | {all, new} | | pointsToTiles, getTileActivities | The tiles of a track, and the activities crossing each tile | | tileToCoords, tilesToOutline | The corners of a tile, and the outlines of a set of tiles | | lngToX, latToY, xToLng, yToLat... | The conversions between coordinates and tiles, and distanceInMeters |

Every function that logs takes a logger with info, warn and error methods. Nothing is logged by default, consoleLogger prints to the console.

The strava-tiles/map and strava-tiles/tiles entry points hold the helpers above and nothing else, for code running in the browser.

Activity images

strava-tiles/images draws an activity as a single image: the ground already covered around it, the tiles it was the first to cover, the tiles it closed in, and the track.

import {getActivityImages, renderActivityImage} from "strava-tiles/images"

const [activityImage] = getActivityImages({
  activities: [{id, start_date, tiles}], // every activity, `tiles` being its `activityTiles`
  groups: [[id]],
})
const {image} = await renderActivityImage({...activityImage, coordinates})

Images need sharp, an optional peer dependency: a project using only the tiles never installs it. npm install sharp to draw images. The options are described in the images documentation.

Support this project