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

terra-route

v0.0.14

Published

A library for routing along GeoJSON LineString networks

Readme

Terra Route aims to be a fast library for routing on GeoJSON LineStrings networks, where LineStrings share identical coordinates.

Install

npm install terra-route

Docs

API Docs can be found here

Example

Here is a short example of how to use the TerraRoute class:

import { FeatureCollection, LineString, Point, Feature } from "geojson";
import { TerraRoute } from "terra-route"; 

// We omit the literal values here in the README for brevity
import { network, startPoint, endPoint } from './network'

// Initialize TerraRoute instance
const router = new TerraRoute();

// network here is a FeatureCollection<LineString> where the all
// identical coordinates are considered connected. 
// We must build the route graph first before calling getRoute.
router.buildRouteGraph(network);

// Get shortest route where startPoint and endpoint are Feature<Point> of 
// a coordinate node which is present on the network (i.e. the coordinate 
// exists in one of the linestrings)
const route = router.getRoute(startPoint, endPoint);

console.log("Shortest route:", JSON.stringify(route, null, 2));

Terra Route Graph

Understanding and debugging routing graphs can be complicated. There is an additional helper library called Terra Route Graph (terra-route-graph) which can be used to help understand the graphs you are working with.

Benchmarks

The benchmarks make use of a series out route example route networks from OSM in a moderate sized section of East London. It runs against the GeoJSON Path Finder library and also the ngraph.graph library. You can run the benchmarks yourself using:

npm run benchmark

Here is an example output of a benchmark run for routing:

Using default Haversine distance, Terra Route is approximately 3.75x faster than GeoJSON Path Finder with Haversine distance for A -> B path finding. If you pass in the CheapRuler distance metric (you can use the exposed createCheapRuler function), it is approximately x8 faster than GeoJSON Path Finder with Haversine distance.

For initialisation of the network, Terra Route is approximately 10x faster with Haversine than GeoJSON Path Finder. Terra Draw splits out instantiating the Class of the library from the actual graph building, which is done via buildRouteGraph. This allows you to defer graph creation to an appropriate time.

Terra Route uses an bi-directional A* algorithm for pathfinding and by default uses a four-ary heap for the underlying priority queue, although this is configurable.

Limitations

  • Terra Route does not currently support weighting functions.
  • Coordinates must be identical to be considered connected

Acknowledgements

Terra Route is inspired by the the prior art of geojson-path-finder and we use this library to help benchmark Terra Routes performance.

License

MIT