Options
All
  • Public
  • Public/Protected
  • All
Menu

Planner.js: A JS library for route planning

🛸️ Build Status 🚴 MIT License 🚉 npm version 🚀

$ npm install plannerjs

Include it in the browser:

<script src="https://planner.js.org/js/planner-latest.js"></script>

...

<script>
  const { FlexibleTransitPlanner, Units } = PlannerJS;
</script>

Include it in your JavaScript project:

const { FlexibleTransitPlanner, Units } = require('plannerjs');

// or

import { FlexibleTransitPlanner, Units } from 'plannerjs';

Use it in both environments:

const planner = new FlexibleTransitPlanner();
planner.addConnectionSource("https://graph.irail.be/sncb/connections");
planner.addStopSource("https://irail.be/stations/NMBS");

planner.query({
  from: "http://irail.be/stations/NMBS/008812005", // Brussels North
  to: "http://irail.be/stations/NMBS/008892007", // Ghent-Sint-Pieters
  minimumDepartureTime: new Date(),

  walkingSpeed: 3, // KmH
  minimumWalkingSpeed: 3, // KmH

  maximumWalkingDistance: 200, // meters

  minimumTransferDuration: Units.fromMinutes(1),
  maximumTransferDuration: Units.fromMinutes(30),

  maximumTravelDuration: Units.fromHours(1.5),

  maximumTransfers: 4,
})
  .take(3)
  .on('data', (path) => {
   console.log(JSON.stringify(path, null, 4));
  })
  .on('end', () => {
    console.log('No more paths!')
  })
  .on('error', (error) => {
    console.error(error);
  });

Documentation

For further instructions, follow the documentation at https://planner.js.org/

Developing

  • Building the docs with typedoc: npm run doc
  • Testing with jest: npm test
  • Build a new browser version with npm run browser
  • Bundle the latest planner for the docs example npm run doc-bundle

Index

Modules

Enumerations

Classes

Interfaces

Type aliases

Variables

Functions

Object literals

Type aliases

ConnectionsFetcherFactory

ConnectionsFetcherFactory: function

Type declaration

DistanceM

DistanceM: number

Represents distance in m (meters)

DurationMs

DurationMs: number

Represents duration in ms (milliseconds)

HypermediaTreeFetcherFactory

HypermediaTreeFetcherFactory: function

Type declaration

IStepResult

NodeCluster

NodeCluster: Set<number>

NodeLabelList

NodeLabelList: boolean[]

NodeList

NodeList: RoutableTileNode[]

Polygon

Polygon: Ring[]

Ring

Ring: ILocation[]

Selector

Selector<T>: function

Type parameters

  • T

Type declaration

    • (values: Array<T | undefined | null>): number
    • Parameters

      • values: Array<T | undefined | null>

      Returns number

SpeedKmH

SpeedKmH: number

Represents duration in km/h (kilometers per hour)

StopsFetcherFactory

StopsFetcherFactory: function

Type declaration

Variables

Const ARRIVAL_DELAY

ARRIVAL_DELAY: "http://semweb.mmlab.be/ns/linkedconnections#arrivalDelay" = "http://semweb.mmlab.be/ns/linkedconnections#arrivalDelay"

Const ARRIVAL_STOP

ARRIVAL_STOP: "http://semweb.mmlab.be/ns/linkedconnections#arrivalStop" = "http://semweb.mmlab.be/ns/linkedconnections#arrivalStop"

Const ARRIVAL_TIME

ARRIVAL_TIME: "http://semweb.mmlab.be/ns/linkedconnections#arrivalTime" = "http://semweb.mmlab.be/ns/linkedconnections#arrivalTime"

Const COST

COST: 3 = 3

Const DCAT

DCAT: "http://www.w3.org/ns/dcat#" = "http://www.w3.org/ns/dcat#"

Const DCT

DCT: "http://purl.org/dc/terms/" = "http://purl.org/dc/terms/"

Const DEPARTURE_DELAY

DEPARTURE_DELAY: "http://semweb.mmlab.be/ns/linkedconnections#departureDelay" = "http://semweb.mmlab.be/ns/linkedconnections#departureDelay"

Const DEPARTURE_STOP

DEPARTURE_STOP: "http://semweb.mmlab.be/ns/linkedconnections#departureStop" = "http://semweb.mmlab.be/ns/linkedconnections#departureStop"

Const DEPARTURE_TIME

DEPARTURE_TIME: "http://semweb.mmlab.be/ns/linkedconnections#departureTime" = "http://semweb.mmlab.be/ns/linkedconnections#departureTime"

Const DISTANCE

DISTANCE: 1 = 1

Const DROP_OFF_TYPE

DROP_OFF_TYPE: "http://vocab.gtfs.org/terms#dropOffType" = "http://vocab.gtfs.org/terms#dropOffType"

Const DURATION

DURATION: 2 = 2

Const GEO

GEO: "http://www.w3.org/2003/01/geo/wgs84_pos" = "http://www.w3.org/2003/01/geo/wgs84_pos"

Const GEOSPARQL

GEOSPARQL: "http://www.opengis.net/ont/geosparql#" = "http://www.opengis.net/ont/geosparql#"

Const GTFS

GTFS: "http://vocab.gtfs.org/terms#" = "http://vocab.gtfs.org/terms#"

Const HEADSIGN

HEADSIGN: "http://vocab.gtfs.org/terms#headsign" = "http://vocab.gtfs.org/terms#headsign"

Const HYDRA

HYDRA: "http://www.w3.org/ns/hydra/core" = "http://www.w3.org/ns/hydra/core"

Const LC

LC: "http://semweb.mmlab.be/ns/linkedconnections#" = "http://semweb.mmlab.be/ns/linkedconnections#"

Const NEXT_CONNECTION

NEXT_CONNECTION: "http://semweb.mmlab.be/ns/linkedconnections#nextConnection" = "http://semweb.mmlab.be/ns/linkedconnections#nextConnection"

Const OSM

OSM: "https://w3id.org/openstreetmap/terms" = "https://w3id.org/openstreetmap/terms"

Const PICKUP_TYPE

PICKUP_TYPE: "http://vocab.gtfs.org/terms#pickupType" = "http://vocab.gtfs.org/terms#pickupType"

Const PLANNER

PLANNER: "https://planner.js.org/terms#" = "https://planner.js.org/terms#"

Const POSITION

POSITION: 0 = 0

Const PROFILE

PROFILE: "https://w3id.org/openplannerteam/profile#" = "https://w3id.org/openplannerteam/profile#"

Const RDF

RDF: "http://www.w3.org/1999/02/22-rdf-syntax-ns" = "http://www.w3.org/1999/02/22-rdf-syntax-ns"

Const RDFS

RDFS: "http://www.w3.org/2000/01/rdf-schema" = "http://www.w3.org/2000/01/rdf-schema"

Const ROUTE

ROUTE: "http://vocab.gtfs.org/terms#route" = "http://vocab.gtfs.org/terms#route"

Const TREE

TREE: "https://w3id.org/tree#" = "https://w3id.org/tree#"

Const TRIP

TRIP: "http://vocab.gtfs.org/terms#trip" = "http://vocab.gtfs.org/terms#trip"

Const XMLS

XMLS: "http://www.w3.org/2001/XMLSchema" = "http://www.w3.org/2001/XMLSchema"

Const ZOOM

ZOOM: 12 = 12

Const container

container: Container = new Container()

Functions

backwardsConnectionsSelector

  • backwardsConnectionsSelector(connections: Array<IConnection | undefined | null>): number

classifyDataSource

  • classifyDataSource(accessUrl: string): Promise<IDataSource>

clusterNodes

createPlanner

createPolygon

createTriangulation

  • createTriangulation(nodes: ILocation[]): Delaunay

edgesOfTriangle

  • edgesOfTriangle(t: any): number[]

forwardsConnectionSelector

  • forwardsConnectionSelector(connections: Array<IConnection | undefined | null>): number

getNeighborTiles

getOsmTagMapping

  • getOsmTagMapping(): object

lat_to_tile

  • lat_to_tile(lat: number, zoom: number): number

long_to_tile

  • long_to_tile(lon: number, zoom: number): number

parseWktLiteral

  • parseWktLiteral(raw: string): any

pointBetween

pointsOfTriangle

  • pointsOfTriangle(delaunay: any, t: any): any[]

tile_to_lat

tile_to_long

toTileCoordinate

  • toTileCoordinate(lat: number, long: number, zoom?: number): TileCoordinate

visualizeConcaveIsochrone

visualizeIsochrone

Object literals

Const DATATYPE

DATATYPE: object

Connections

Connections: symbol = Symbol("Connection")

Footpath

Footpath: symbol = Symbol("Footpath")

Profile

Profile: symbol = Symbol("Profile")

ReducedRoutableTile

ReducedRoutableTile: symbol = Symbol("ReducedRoutableTile")

RoutableTile

RoutableTile: symbol = Symbol("RoutableTile")

Stops

Stops: symbol = Symbol("Stop")

Unknown

Unknown: symbol = Symbol("?")

ZoiTile

ZoiTile: symbol = Symbol("ZoiTile")

Const TYPES

TYPES: object

CatalogFetcher

CatalogFetcher: symbol = Symbol("CatalogFetcher")

CatalogProvider

CatalogProvider: symbol = Symbol("CatalogProvider")

ConnectionsFetcher

ConnectionsFetcher: symbol = Symbol("ConnectionsFetcher")

ConnectionsFetcherFactory

ConnectionsFetcherFactory: symbol = Symbol("ConnectionsFetcherFactory")

ConnectionsProvider

ConnectionsProvider: symbol = Symbol("ConnectionsProvider")

Context

Context: symbol = Symbol("Context")

EventBus

EventBus: symbol = Symbol("EventBus")

FootpathsProvider

FootpathsProvider: symbol = Symbol("FootpathsProvider")

HydraTemplateFetcher

HydraTemplateFetcher: symbol = Symbol("HydraTemplateFetcher")

HypermediaTreeFetcher

HypermediaTreeFetcher: symbol = Symbol("HypermediaTreeFetcher")

HypermediaTreeFetcherFactory

HypermediaTreeFetcherFactory: symbol = Symbol("HypermediaTreeFetcherFactory")

HypermediaTreeProvider

HypermediaTreeProvider: symbol = Symbol("HypermediaTreeProvider")

JourneyExtractor

JourneyExtractor: symbol = Symbol("JourneyExtractor")

LDFetch

LDFetch: symbol = Symbol("LDFetch")

LDLoader

LDLoader: symbol = Symbol("LDLoader")

LocationResolver

LocationResolver: symbol = Symbol("LocationResolver")

PathfinderProvider

PathfinderProvider: symbol = Symbol("PathfinderProvider")

ProfileFetcher

ProfileFetcher: symbol = Symbol("ProfileFetcher")

ProfileProvider

ProfileProvider: symbol = Symbol("ProfileProvider")

PublicTransportPlanner

PublicTransportPlanner: symbol = Symbol("PublicTransportPlanner")

PublicTransportPlannerFactory

PublicTransportPlannerFactory: symbol = Symbol("PublicTransportPlannerFactory")

QueryRunner

QueryRunner: symbol = Symbol("QueryRunner")

ReachableStopsFinder

ReachableStopsFinder: symbol = Symbol("ReachableStopsFinder")

RoadPlanner

RoadPlanner: symbol = Symbol("RoadPlanner")

RoadPlannerFactory

RoadPlannerFactory: symbol = Symbol("RoadPlannerFactory")

RoutableTileFetcher

RoutableTileFetcher: symbol = Symbol("TileFetcher")

RoutableTileProvider

RoutableTileProvider: symbol = Symbol("TileProvider")

ShortestPathAlgorithm

ShortestPathAlgorithm: symbol = Symbol("ShortestPathAlgorithm")

ShortestPathTreeAlgorithm

ShortestPathTreeAlgorithm: symbol = Symbol("ShortestPathTreeAlgorithm")

StopsFetcher

StopsFetcher: symbol = Symbol("StopsFetcher")

StopsFetcherFactory

StopsFetcherFactory: symbol = Symbol("StopsFetcherFactory")

StopsProvider

StopsProvider: symbol = Symbol("StopsProvider")

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Type alias with type parameter
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method

Generated using TypeDoc