Skip to content

JavaScript library for route planning – Launch in February 2019 πŸš΄β€β™‚οΈπŸš‰πŸš€

License

Notifications You must be signed in to change notification settings

jflipts/planner.js

Β 
Β 

Repository files navigation

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

About

JavaScript library for route planning – Launch in February 2019 πŸš΄β€β™‚οΈπŸš‰πŸš€

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • TypeScript 97.9%
  • HTML 1.6%
  • JavaScript 0.5%