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 { BasicTrainPlanner, Units } = PlannerJS;
</script>

Include it in your JavaScript project:

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

// or

import { BasicTrainPlanner, Units } from 'plannerjs';

Use it in both environments:

const planner = new BasicTrainPlanner();

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)

IStepResult

NodeCluster

NodeCluster: Set<number>

NodeLabelList

NodeLabelList: boolean[]

NodeList

NodeList: RoutableTileNode[]

Polygon

Polygon: Ring[]

Ring

Ring: ILocation[]

SpeedKmH

SpeedKmH: number

Represents duration in km/h (kilometers per hour)

StopsFetcherFactory

StopsFetcherFactory: function

Type declaration

Variables

Const GEO

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

Const HYDRA

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

Const OSM

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

Const PLANNER

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

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: "https://w3id.org/routabletiles/terms#" = "https://w3id.org/routabletiles/terms#"

Const XMLS

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

Const ZOOM

ZOOM: 12 = 12

Const catalogDeLijn

catalogDeLijn: Catalog = new Catalog()

Const catalogMivb

catalogMivb: Catalog = new Catalog()

Const catalogNmbs

catalogNmbs: Catalog = new Catalog()

Const catalogTec

catalogTec: Catalog = new Catalog()

Const combined

combined: Catalog = Catalog.combine(catalogNmbs, catalogDeLijn)

Const container

container: Container = new Container()

Const x

x: IsochroneGenerator = new IsochroneGenerator({ latitude: 51.0262973, longitude: 3.7110885 })

Functions

clusterNodes

createPolygon

createTriangulation

  • createTriangulation(nodes: ILocation[]): Delaunay

edgesOfTriangle

  • edgesOfTriangle(t: any): number[]

getNeighborTiles

getOsmTagMapping

  • getOsmTagMapping(): object

lat_to_tile

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

    • lat: number
    • zoom: number

    Returns number

long_to_tile

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

    • lon: number
    • zoom: number

    Returns number

pointBetween

pointsOfTriangle

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

tile_to_lat

tile_to_long

toTileCoordinate

visualizeConcaveIsochrone

visualizeIsochrone

Object literals

Const TYPES

TYPES: object

Catalog

Catalog: symbol = Symbol("Catalog")

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")

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")

RoutableTileRegistry

RoutableTileRegistry: symbol = Symbol("RoutableTileRegistry")

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