mirror of
https://github.com/HSLdevcom/digitransit-ui
synced 2025-07-27 15:05:15 +02:00
110 lines
2.8 KiB
Markdown
110 lines
2.8 KiB
Markdown
# @digitransit-store/digitransit-store-future-route
|
|
|
|
<!-- Generated by documentation.js. Update this documentation by updating the source code. -->
|
|
|
|
## extractRoute
|
|
|
|
### Parameters
|
|
|
|
- `routeIn`
|
|
|
|
### Examples
|
|
|
|
```javascript
|
|
const oldRouteCollection = {
|
|
[
|
|
{
|
|
type: 'FutureRoute',
|
|
properties: {
|
|
layer: 'futureRoute',
|
|
origin: {
|
|
name: 'Pasila',
|
|
localadmin: 'Helsinki',
|
|
coordinates: {
|
|
lat: 60.198828,
|
|
lon: 24.933514,
|
|
},
|
|
},
|
|
destination: {
|
|
name: 'Ilmala',
|
|
localadmin: 'Helsinki',
|
|
coordinates: {
|
|
lat: 60.208466,
|
|
lon: 24.919756,
|
|
},
|
|
},
|
|
arriveBy: 'true',
|
|
time: 1600866900,
|
|
url: '/reitti/Pasila%2C%20Helsinki%3A%3A60.198828%2C24.933514/Ilmala%2C%20Helsinki%3A%3A60.208466%2C24.919756?arriveBy=true&time=1600866900',
|
|
},
|
|
},
|
|
{
|
|
type: 'FutureRoute',
|
|
properties: {
|
|
layer: 'futureRoute',
|
|
origin: {
|
|
name: 'Ilmala',
|
|
localadmin: 'Helsinki',
|
|
coordinates: {
|
|
lat: 60.208466,
|
|
lon: 24.919756,
|
|
},
|
|
},
|
|
destination: {
|
|
name: 'Pasila',
|
|
localadmin: 'Helsinki',
|
|
coordinates: {
|
|
lat: 60.198828,
|
|
lon: 24.933514,
|
|
},
|
|
},
|
|
time: 1600877700,
|
|
url: '/reitti/Ilmala%2C%20Helsinki%3A%3A60.208466%2C24.919756/Pasila%2C%20Helsinki%3A%3A60.198828%2C24.933514?arriveBy=true&time=1600877700',
|
|
},
|
|
},
|
|
],
|
|
}
|
|
|
|
const newRoute = {
|
|
origin: {
|
|
address: 'Pasila, Helsinki',
|
|
coordinates: { lat: 60.198828, lon: 24.933514 },
|
|
},
|
|
destination: {
|
|
address: 'Myyrmäki, Vantaa',
|
|
coordinates: { lat: 60.261238, lon: 24.854782 },
|
|
},
|
|
arriveBy: false,
|
|
time: 1600888888,
|
|
};
|
|
|
|
//add newRoute to oldRouteCollection
|
|
const newRouteCollection = addFutureRoute(newRoute, oldRouteCollection, { prefixItinerarySummary: 'reitti' });
|
|
|
|
const url = createUrl(newRoute, { prefixItinerarySummary: 'reitti' });
|
|
//'/reitti/Pasila%2C%20Helsinki%3A%3A60.198828%2C24.933514/Myyrmäki%2C%20Vantaa%3A%3A60.261238%2C24.854782?time=1600888888'
|
|
```
|
|
|
|
<!-- This file is automatically generated. Please don't edit it directly:
|
|
if you find an error, edit the source file (likely index.js), and re-run
|
|
./scripts/generate-readmes in the digitransit-store project. -->
|
|
|
|
---
|
|
|
|
This module is part of the Digitransit-ui project. It is maintained in the
|
|
[HSLdevcom/digitransit-ui](https://github.com/HSLdevcom/digitransit-ui) repository, where you can create
|
|
PRs and issues.
|
|
|
|
### Installation
|
|
|
|
Install this module individually:
|
|
|
|
```sh
|
|
$ npm install @digitransit-store/digitransit-store-future-route
|
|
```
|
|
|
|
Or install the Digitransit-store module that includes it as a function:
|
|
|
|
```sh
|
|
$ npm install @digitransit-store/digitransit-store
|
|
```
|