├── .editorconfig ├── CNAME ├── README.md ├── code-of-conduct.md ├── contributing.md ├── examples ├── invalid-journey.json ├── valid-journey.json └── valid-simple-journey.json ├── license ├── modules.md ├── package.json └── spec └── readme.md /.editorconfig: -------------------------------------------------------------------------------- 1 | # editorconfig.org 2 | root = true 3 | 4 | [*] 5 | end_of_line = lf 6 | charset = utf-8 7 | trim_trailing_whitespace = true 8 | insert_final_newline = true 9 | 10 | # Use tabs in JSON. 11 | [**.{js, json}] 12 | indent_style = tab 13 | indent_size = 4 14 | -------------------------------------------------------------------------------- /CNAME: -------------------------------------------------------------------------------- 1 | fptf.io -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Friendly Public Transport Format (FPTF) 2 | 3 | This repo outlines **a format for APIs, libraries and datasets containing and working with public transport data.** See **[the spec](spec/readme.md)** and the [list of JS modules](modules.md). 4 | 5 | [![npm version](https://img.shields.io/npm/v/friendly-public-transport-format.svg)](https://www.npmjs.com/package/friendly-public-transport-format) 6 | ![CC-licensed](https://img.shields.io/github/license/public-transport/friendly-public-transport-format.svg) 7 | [![chat on gitter](https://badges.gitter.im/public-transport/Lobby.svg)](https://gitter.im/public-transport/Lobby) 8 | 9 | It tries to keep things simple: 10 | 11 | - JSON and [ndjson](http://ndjson.org) only 12 | - a flat, intuitive representation of public transport timetables & infrastructure 13 | - conceptually inspired by the de-facto standard [GTFS](https://developers.google.com/transit/gtfs/) 14 | 15 | Specifically, it trades 16 | 17 | - efficiency for consumability: GTFS sets feel like database dumps. 18 | - completeness for ease-of-use: Only basic attributes are required, most is optional. 19 | 20 | Things still missing: 21 | 22 | - concise definitions 23 | - clear naming & recommendations for optional data 24 | 25 | There's also a work-in-progress spec for APIs building on top of the FPTF format: the [*Friendly Public Transport Interface* for JavaScript (FPTI-JS)](https://github.com/public-transport/fpti-js). 26 | 27 | 28 | ## Contributing 29 | 30 | We are looking forward to discuss & extend this format further! If you have a question or want to propose changes, go to [the issues page](https://github.com/public-transport/friendly-public-transport-format/issues). Keep our [contributing guidelines in mind](contributing.md). Note that, by participating in this project, you commit to the [code of conduct](code-of-conduct.md). 31 | -------------------------------------------------------------------------------- /code-of-conduct.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation. 6 | 7 | ## Our Standards 8 | 9 | Examples of behavior that contributes to creating a positive environment include: 10 | 11 | * Using welcoming and inclusive language 12 | * Being respectful of differing viewpoints and experiences 13 | * Gracefully accepting constructive criticism 14 | * Focusing on what is best for the community 15 | * Showing empathy towards other community members 16 | 17 | Examples of unacceptable behavior by participants include: 18 | 19 | * The use of sexualized language or imagery and unwelcome sexual attention or advances 20 | * Trolling, insulting/derogatory comments, and personal or political attacks 21 | * Public or private harassment 22 | * Publishing others' private information, such as a physical or electronic address, without explicit permission 23 | * Other conduct which could reasonably be considered inappropriate in a professional setting 24 | 25 | ## Our Responsibilities 26 | 27 | Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior. 28 | 29 | Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful. 30 | 31 | ## Scope 32 | 33 | This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers. 34 | 35 | ## Enforcement 36 | 37 | Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at `mail@juliustens.eu`. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately. 38 | 39 | Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership. 40 | 41 | ## Attribution 42 | 43 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version] 44 | 45 | [homepage]: http://contributor-covenant.org 46 | [version]: http://contributor-covenant.org/version/1/4/ 47 | -------------------------------------------------------------------------------- /contributing.md: -------------------------------------------------------------------------------- 1 | # contributing guidelines 2 | 3 | Thanks for bringing your ideas into this project! 4 | 5 | - Make sure your change is in line with the [vision for this format](README.md). 6 | - Because this project tries is community-lead, **you should propose all changes as [issues](https://help.github.com/articles/about-issues/) or [pull requests](https://help.github.com/articles/about-pull-requests/).** Thus, everyone can then voice their opinion on the change and it can be adapted. 7 | - To propose large or potentially controversial changes, open an issue first. We can then discuss whether it's worth investing time into a pull request. Submit small changes such as corrected typos as pull requests immediately. 8 | - By participating in this project, you commit to the [code of conduct](code-of-conduct.md). 9 | 10 | ## adapting the spec 11 | 12 | - Make sure that you update all files that implicitly depend on the spec, such as examples or the readme. 13 | - Submit a pull request at [`validate-fptf`](https://github.com/public-transport/validate-fptf) so that it reflects the changed spec. If you're not sure how to adapt it, open an issue so that others can do this. 14 | 15 | ## creating a new version 16 | 17 | - This project follows [SemVer](http://semver.org). **Increase the *major* version number whenever the new version might break dependent projects.** 18 | - **[Tag](https://git-scm.com/book/en/v2/Git-Basics-Tagging) the commit** with the new version, e.g. by running `git tag -a 0.7.1 -m 'v0.7.1'`. This is important for dependant projects to be able to reference a specific version of the spec. 19 | -------------------------------------------------------------------------------- /examples/invalid-journey.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "journey", 3 | "id": "12345", 4 | "legs": [{ 5 | "origin": { 6 | "type": "station", 7 | "id": "10001", 8 | "name": "Foo Station", 9 | "location": { 10 | "type": "location", 11 | "longitude": -20, 12 | "latitude": "30" 13 | } 14 | }, 15 | "destination": { 16 | "type": "station", 17 | "id": null, 18 | "name": "Baz Main Station", 19 | "location": { 20 | "type": "loc", 21 | "longitude": 20, 22 | "latitude": -30, 23 | "altitude": 1400 24 | }, 25 | "coordinates": { 26 | "longitude": 20, 27 | "latitude": -30 28 | } 29 | }, 30 | "departure": 1489690800000, 31 | "departurePlatform": "4-1", 32 | "departureDelay": 10, 33 | "arrival": "2017-03-17T15:00:00+02:00", 34 | "arrivalPlatform": "9", 35 | "arrivalDelay": "10s", 36 | "schedule": { 37 | "type": "schedule", 38 | "id": "1234", 39 | "route": { 40 | "type": "route", 41 | "id": "123", 42 | "line": { 43 | "type": "line", 44 | "id": "12", 45 | "name": "Magic Interplanetary Express", 46 | "mode": "ufo", 47 | "operator": { 48 | "type": "operator", 49 | "id": "1", 50 | "name": "" 51 | } 52 | }, 53 | "stops": [ 54 | "10001", 55 | { 56 | "type": "stop", 57 | "id": "10002-a", 58 | "station": { 59 | "type": "station", 60 | "id": "10002", 61 | "name": "Bar City Center" 62 | }, 63 | "name": "train station" 64 | }, 65 | "10003" 66 | ] 67 | }, 68 | "mode": "train", 69 | "sequence": [ 70 | { 71 | "departure": 0 72 | }, 73 | { 74 | "arrival": 3720, 75 | "departure": 3600 76 | }, 77 | { 78 | "arrival": 64800 79 | } 80 | ], 81 | "starts": [ 82 | 1489604400, 83 | 1489690800, 84 | 1489777200 85 | ] 86 | }, 87 | "stopovers": [{ 88 | "type": "stopover", 89 | "stop": "10001", 90 | "arrival": null, 91 | "arrivalPlatform": null, 92 | "departure": null, 93 | "departurePlatform": 1, 94 | "departureDelay": null 95 | }, { 96 | "type": "stopover", 97 | "arrival": "2017-03-17T15:00:00+02:00", 98 | "arrivalPlatform": "9", 99 | "arrivalDelay": 0 100 | }], 101 | "public": true, 102 | "operator": { 103 | "type": "operator", 104 | "id": "2", 105 | "name": "2 Replacement Railway Services Inc." 106 | }, 107 | "price": { 108 | "amount": 0, 109 | "currency": null 110 | } 111 | }], 112 | "price": { 113 | "amount": 19.95, 114 | "currency": "EUR" 115 | } 116 | } 117 | -------------------------------------------------------------------------------- /examples/valid-journey.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "journey", 3 | "id": "12345", 4 | "legs": [{ 5 | "origin": { 6 | "type": "station", 7 | "id": "10001", 8 | "name": "Foo Station", 9 | "location": { 10 | "type": "location", 11 | "longitude": -20, 12 | "latitude": 30 13 | } 14 | }, 15 | "destination": { 16 | "type": "station", 17 | "id": "10003", 18 | "name": "Baz Main Station", 19 | "location": { 20 | "type": "location", 21 | "longitude": 20, 22 | "latitude": -30, 23 | "altitude": 1400 24 | } 25 | }, 26 | "departure": "2017-03-16T20:00:00+01:00", 27 | "departurePlatform": "4-1", 28 | "departureDelay": null, 29 | "arrival": "2017-03-17T15:00:00+02:00", 30 | "arrivalPlatform": "9", 31 | "arrivalDelay": 0, 32 | "schedule": { 33 | "type": "schedule", 34 | "id": "1234", 35 | "route": { 36 | "type": "route", 37 | "id": "123", 38 | "line": { 39 | "type": "line", 40 | "id": "12", 41 | "name": "Magic Intercontinental Express", 42 | "mode": "train", 43 | "operator": { 44 | "type": "operator", 45 | "id": "1", 46 | "name": "1 Railways Inc." 47 | } 48 | }, 49 | "stops": [ 50 | "10001", 51 | { 52 | "type": "stop", 53 | "id": "10002-a", 54 | "station": { 55 | "type": "station", 56 | "id": "10002", 57 | "name": "Bar City Center" 58 | }, 59 | "name": "train station" 60 | }, 61 | "10003" 62 | ] 63 | }, 64 | "mode": "train", 65 | "sequence": [ 66 | { 67 | "departure": 0 68 | }, 69 | { 70 | "arrival": 3600, 71 | "departure": 3720 72 | }, 73 | { 74 | "arrival": 64800 75 | } 76 | ], 77 | "starts": [ 78 | 1489604400, 79 | 1489690800, 80 | 1489777200 81 | ] 82 | }, 83 | "stopovers": [{ 84 | "type": "stopover", 85 | "stop": "10001", 86 | "arrival": null, 87 | "arrivalPlatform": null, 88 | "departure": "2017-03-16T20:00:00+01:00", 89 | "departurePlatform": "4-1", 90 | "departureDelay": null 91 | }, { 92 | "type": "stopover", 93 | "stop": "10002-a", 94 | "arrival": "2017-03-16T21:01:30+01:00", 95 | "arrivalPlatform": "C", 96 | "arrivalDelay": 90, 97 | "departure": "2017-03-16T21:03:00+01:00", 98 | "departurePlatform": "C", 99 | "departureDelay": 60 100 | }, { 101 | "type": "stopover", 102 | "stop": "10003", 103 | "arrival": "2017-03-17T15:00:00+02:00", 104 | "arrivalPlatform": "9", 105 | "arrivalDelay": 0, 106 | "departure": null, 107 | "departurePlatform": null 108 | }], 109 | "public": true, 110 | "operator": { 111 | "type": "operator", 112 | "id": "2", 113 | "name": "2 Replacement Railway Services Inc." 114 | }, 115 | "price": { 116 | "amount": 19.95, 117 | "currency": "EUR" 118 | } 119 | }], 120 | "price": { 121 | "amount": 19.95, 122 | "currency": "EUR" 123 | } 124 | } 125 | -------------------------------------------------------------------------------- /examples/valid-simple-journey.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "journey", 3 | "id": "12345", 4 | "legs": [{ 5 | "origin": "10001", 6 | "destination": "10003", 7 | "departure": "2017-03-16T20:00:00+01:00", 8 | "departurePlatform": "4-1", 9 | "departureDelay": null, 10 | "arrival": "2017-03-17T15:00:00+02:00", 11 | "arrivalPlatform": "9", 12 | "arrivalDelay": 30, 13 | "schedule": "1234", 14 | "public": true, 15 | "operator": "2", 16 | "price": { 17 | "amount": 19.95, 18 | "currency": "EUR" 19 | } 20 | }], 21 | "price": { 22 | "amount": 19.95, 23 | "currency": "EUR" 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /license: -------------------------------------------------------------------------------- 1 | Attribution-ShareAlike 4.0 International 2 | 3 | ======================================================================= 4 | 5 | Creative Commons Corporation ("Creative Commons") is not a law firm and 6 | does not provide legal services or legal advice. Distribution of 7 | Creative Commons public licenses does not create a lawyer-client or 8 | other relationship. Creative Commons makes its licenses and related 9 | information available on an "as-is" basis. Creative Commons gives no 10 | warranties regarding its licenses, any material licensed under their 11 | terms and conditions, or any related information. Creative Commons 12 | disclaims all liability for damages resulting from their use to the 13 | fullest extent possible. 14 | 15 | Using Creative Commons Public Licenses 16 | 17 | Creative Commons public licenses provide a standard set of terms and 18 | conditions that creators and other rights holders may use to share 19 | original works of authorship and other material subject to copyright 20 | and certain other rights specified in the public license below. The 21 | following considerations are for informational purposes only, are not 22 | exhaustive, and do not form part of our licenses. 23 | 24 | Considerations for licensors: Our public licenses are 25 | intended for use by those authorized to give the public 26 | permission to use material in ways otherwise restricted by 27 | copyright and certain other rights. Our licenses are 28 | irrevocable. Licensors should read and understand the terms 29 | and conditions of the license they choose before applying it. 30 | Licensors should also secure all rights necessary before 31 | applying our licenses so that the public can reuse the 32 | material as expected. Licensors should clearly mark any 33 | material not subject to the license. This includes other CC- 34 | licensed material, or material used under an exception or 35 | limitation to copyright. More considerations for licensors: 36 | wiki.creativecommons.org/Considerations_for_licensors 37 | 38 | Considerations for the public: By using one of our public 39 | licenses, a licensor grants the public permission to use the 40 | licensed material under specified terms and conditions. If 41 | the licensor's permission is not necessary for any reason--for 42 | example, because of any applicable exception or limitation to 43 | copyright--then that use is not regulated by the license. Our 44 | licenses grant only permissions under copyright and certain 45 | other rights that a licensor has authority to grant. Use of 46 | the licensed material may still be restricted for other 47 | reasons, including because others have copyright or other 48 | rights in the material. A licensor may make special requests, 49 | such as asking that all changes be marked or described. 50 | Although not required by our licenses, you are encouraged to 51 | respect those requests where reasonable. More_considerations 52 | for the public: 53 | wiki.creativecommons.org/Considerations_for_licensees 54 | 55 | ======================================================================= 56 | 57 | Creative Commons Attribution-ShareAlike 4.0 International Public 58 | License 59 | 60 | By exercising the Licensed Rights (defined below), You accept and agree 61 | to be bound by the terms and conditions of this Creative Commons 62 | Attribution-ShareAlike 4.0 International Public License ("Public 63 | License"). To the extent this Public License may be interpreted as a 64 | contract, You are granted the Licensed Rights in consideration of Your 65 | acceptance of these terms and conditions, and the Licensor grants You 66 | such rights in consideration of benefits the Licensor receives from 67 | making the Licensed Material available under these terms and 68 | conditions. 69 | 70 | 71 | Section 1 -- Definitions. 72 | 73 | a. Adapted Material means material subject to Copyright and Similar 74 | Rights that is derived from or based upon the Licensed Material 75 | and in which the Licensed Material is translated, altered, 76 | arranged, transformed, or otherwise modified in a manner requiring 77 | permission under the Copyright and Similar Rights held by the 78 | Licensor. For purposes of this Public License, where the Licensed 79 | Material is a musical work, performance, or sound recording, 80 | Adapted Material is always produced where the Licensed Material is 81 | synched in timed relation with a moving image. 82 | 83 | b. Adapter's License means the license You apply to Your Copyright 84 | and Similar Rights in Your contributions to Adapted Material in 85 | accordance with the terms and conditions of this Public License. 86 | 87 | c. BY-SA Compatible License means a license listed at 88 | creativecommons.org/compatiblelicenses, approved by Creative 89 | Commons as essentially the equivalent of this Public License. 90 | 91 | d. Copyright and Similar Rights means copyright and/or similar rights 92 | closely related to copyright including, without limitation, 93 | performance, broadcast, sound recording, and Sui Generis Database 94 | Rights, without regard to how the rights are labeled or 95 | categorized. For purposes of this Public License, the rights 96 | specified in Section 2(b)(1)-(2) are not Copyright and Similar 97 | Rights. 98 | 99 | e. Effective Technological Measures means those measures that, in the 100 | absence of proper authority, may not be circumvented under laws 101 | fulfilling obligations under Article 11 of the WIPO Copyright 102 | Treaty adopted on December 20, 1996, and/or similar international 103 | agreements. 104 | 105 | f. Exceptions and Limitations means fair use, fair dealing, and/or 106 | any other exception or limitation to Copyright and Similar Rights 107 | that applies to Your use of the Licensed Material. 108 | 109 | g. License Elements means the license attributes listed in the name 110 | of a Creative Commons Public License. The License Elements of this 111 | Public License are Attribution and ShareAlike. 112 | 113 | h. Licensed Material means the artistic or literary work, database, 114 | or other material to which the Licensor applied this Public 115 | License. 116 | 117 | i. Licensed Rights means the rights granted to You subject to the 118 | terms and conditions of this Public License, which are limited to 119 | all Copyright and Similar Rights that apply to Your use of the 120 | Licensed Material and that the Licensor has authority to license. 121 | 122 | j. Licensor means the individual(s) or entity(ies) granting rights 123 | under this Public License. 124 | 125 | k. Share means to provide material to the public by any means or 126 | process that requires permission under the Licensed Rights, such 127 | as reproduction, public display, public performance, distribution, 128 | dissemination, communication, or importation, and to make material 129 | available to the public including in ways that members of the 130 | public may access the material from a place and at a time 131 | individually chosen by them. 132 | 133 | l. Sui Generis Database Rights means rights other than copyright 134 | resulting from Directive 96/9/EC of the European Parliament and of 135 | the Council of 11 March 1996 on the legal protection of databases, 136 | as amended and/or succeeded, as well as other essentially 137 | equivalent rights anywhere in the world. 138 | 139 | m. You means the individual or entity exercising the Licensed Rights 140 | under this Public License. Your has a corresponding meaning. 141 | 142 | 143 | Section 2 -- Scope. 144 | 145 | a. License grant. 146 | 147 | 1. Subject to the terms and conditions of this Public License, 148 | the Licensor hereby grants You a worldwide, royalty-free, 149 | non-sublicensable, non-exclusive, irrevocable license to 150 | exercise the Licensed Rights in the Licensed Material to: 151 | 152 | a. reproduce and Share the Licensed Material, in whole or 153 | in part; and 154 | 155 | b. produce, reproduce, and Share Adapted Material. 156 | 157 | 2. Exceptions and Limitations. For the avoidance of doubt, where 158 | Exceptions and Limitations apply to Your use, this Public 159 | License does not apply, and You do not need to comply with 160 | its terms and conditions. 161 | 162 | 3. Term. The term of this Public License is specified in Section 163 | 6(a). 164 | 165 | 4. Media and formats; technical modifications allowed. The 166 | Licensor authorizes You to exercise the Licensed Rights in 167 | all media and formats whether now known or hereafter created, 168 | and to make technical modifications necessary to do so. The 169 | Licensor waives and/or agrees not to assert any right or 170 | authority to forbid You from making technical modifications 171 | necessary to exercise the Licensed Rights, including 172 | technical modifications necessary to circumvent Effective 173 | Technological Measures. For purposes of this Public License, 174 | simply making modifications authorized by this Section 2(a) 175 | (4) never produces Adapted Material. 176 | 177 | 5. Downstream recipients. 178 | 179 | a. Offer from the Licensor -- Licensed Material. Every 180 | recipient of the Licensed Material automatically 181 | receives an offer from the Licensor to exercise the 182 | Licensed Rights under the terms and conditions of this 183 | Public License. 184 | 185 | b. Additional offer from the Licensor -- Adapted Material. 186 | Every recipient of Adapted Material from You 187 | automatically receives an offer from the Licensor to 188 | exercise the Licensed Rights in the Adapted Material 189 | under the conditions of the Adapter's License You apply. 190 | 191 | c. No downstream restrictions. You may not offer or impose 192 | any additional or different terms or conditions on, or 193 | apply any Effective Technological Measures to, the 194 | Licensed Material if doing so restricts exercise of the 195 | Licensed Rights by any recipient of the Licensed 196 | Material. 197 | 198 | 6. No endorsement. Nothing in this Public License constitutes or 199 | may be construed as permission to assert or imply that You 200 | are, or that Your use of the Licensed Material is, connected 201 | with, or sponsored, endorsed, or granted official status by, 202 | the Licensor or others designated to receive attribution as 203 | provided in Section 3(a)(1)(A)(i). 204 | 205 | b. Other rights. 206 | 207 | 1. Moral rights, such as the right of integrity, are not 208 | licensed under this Public License, nor are publicity, 209 | privacy, and/or other similar personality rights; however, to 210 | the extent possible, the Licensor waives and/or agrees not to 211 | assert any such rights held by the Licensor to the limited 212 | extent necessary to allow You to exercise the Licensed 213 | Rights, but not otherwise. 214 | 215 | 2. Patent and trademark rights are not licensed under this 216 | Public License. 217 | 218 | 3. To the extent possible, the Licensor waives any right to 219 | collect royalties from You for the exercise of the Licensed 220 | Rights, whether directly or through a collecting society 221 | under any voluntary or waivable statutory or compulsory 222 | licensing scheme. In all other cases the Licensor expressly 223 | reserves any right to collect such royalties. 224 | 225 | 226 | Section 3 -- License Conditions. 227 | 228 | Your exercise of the Licensed Rights is expressly made subject to the 229 | following conditions. 230 | 231 | a. Attribution. 232 | 233 | 1. If You Share the Licensed Material (including in modified 234 | form), You must: 235 | 236 | a. retain the following if it is supplied by the Licensor 237 | with the Licensed Material: 238 | 239 | i. identification of the creator(s) of the Licensed 240 | Material and any others designated to receive 241 | attribution, in any reasonable manner requested by 242 | the Licensor (including by pseudonym if 243 | designated); 244 | 245 | ii. a copyright notice; 246 | 247 | iii. a notice that refers to this Public License; 248 | 249 | iv. a notice that refers to the disclaimer of 250 | warranties; 251 | 252 | v. a URI or hyperlink to the Licensed Material to the 253 | extent reasonably practicable; 254 | 255 | b. indicate if You modified the Licensed Material and 256 | retain an indication of any previous modifications; and 257 | 258 | c. indicate the Licensed Material is licensed under this 259 | Public License, and include the text of, or the URI or 260 | hyperlink to, this Public License. 261 | 262 | 2. You may satisfy the conditions in Section 3(a)(1) in any 263 | reasonable manner based on the medium, means, and context in 264 | which You Share the Licensed Material. For example, it may be 265 | reasonable to satisfy the conditions by providing a URI or 266 | hyperlink to a resource that includes the required 267 | information. 268 | 269 | 3. If requested by the Licensor, You must remove any of the 270 | information required by Section 3(a)(1)(A) to the extent 271 | reasonably practicable. 272 | 273 | b. ShareAlike. 274 | 275 | In addition to the conditions in Section 3(a), if You Share 276 | Adapted Material You produce, the following conditions also apply. 277 | 278 | 1. The Adapter's License You apply must be a Creative Commons 279 | license with the same License Elements, this version or 280 | later, or a BY-SA Compatible License. 281 | 282 | 2. You must include the text of, or the URI or hyperlink to, the 283 | Adapter's License You apply. You may satisfy this condition 284 | in any reasonable manner based on the medium, means, and 285 | context in which You Share Adapted Material. 286 | 287 | 3. You may not offer or impose any additional or different terms 288 | or conditions on, or apply any Effective Technological 289 | Measures to, Adapted Material that restrict exercise of the 290 | rights granted under the Adapter's License You apply. 291 | 292 | 293 | Section 4 -- Sui Generis Database Rights. 294 | 295 | Where the Licensed Rights include Sui Generis Database Rights that 296 | apply to Your use of the Licensed Material: 297 | 298 | a. for the avoidance of doubt, Section 2(a)(1) grants You the right 299 | to extract, reuse, reproduce, and Share all or a substantial 300 | portion of the contents of the database; 301 | 302 | b. if You include all or a substantial portion of the database 303 | contents in a database in which You have Sui Generis Database 304 | Rights, then the database in which You have Sui Generis Database 305 | Rights (but not its individual contents) is Adapted Material, 306 | 307 | including for purposes of Section 3(b); and 308 | c. You must comply with the conditions in Section 3(a) if You Share 309 | all or a substantial portion of the contents of the database. 310 | 311 | For the avoidance of doubt, this Section 4 supplements and does not 312 | replace Your obligations under this Public License where the Licensed 313 | Rights include other Copyright and Similar Rights. 314 | 315 | 316 | Section 5 -- Disclaimer of Warranties and Limitation of Liability. 317 | 318 | a. UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE 319 | EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS 320 | AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF 321 | ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS, 322 | IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION, 323 | WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR 324 | PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS, 325 | ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT 326 | KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT 327 | ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU. 328 | 329 | b. TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE 330 | TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION, 331 | NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT, 332 | INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES, 333 | COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR 334 | USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN 335 | ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR 336 | DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR 337 | IN PART, THIS LIMITATION MAY NOT APPLY TO YOU. 338 | 339 | c. The disclaimer of warranties and limitation of liability provided 340 | above shall be interpreted in a manner that, to the extent 341 | possible, most closely approximates an absolute disclaimer and 342 | waiver of all liability. 343 | 344 | 345 | Section 6 -- Term and Termination. 346 | 347 | a. This Public License applies for the term of the Copyright and 348 | Similar Rights licensed here. However, if You fail to comply with 349 | this Public License, then Your rights under this Public License 350 | terminate automatically. 351 | 352 | b. Where Your right to use the Licensed Material has terminated under 353 | Section 6(a), it reinstates: 354 | 355 | 1. automatically as of the date the violation is cured, provided 356 | it is cured within 30 days of Your discovery of the 357 | violation; or 358 | 359 | 2. upon express reinstatement by the Licensor. 360 | 361 | For the avoidance of doubt, this Section 6(b) does not affect any 362 | right the Licensor may have to seek remedies for Your violations 363 | of this Public License. 364 | 365 | c. For the avoidance of doubt, the Licensor may also offer the 366 | Licensed Material under separate terms or conditions or stop 367 | distributing the Licensed Material at any time; however, doing so 368 | will not terminate this Public License. 369 | 370 | d. Sections 1, 5, 6, 7, and 8 survive termination of this Public 371 | License. 372 | 373 | 374 | Section 7 -- Other Terms and Conditions. 375 | 376 | a. The Licensor shall not be bound by any additional or different 377 | terms or conditions communicated by You unless expressly agreed. 378 | 379 | b. Any arrangements, understandings, or agreements regarding the 380 | Licensed Material not stated herein are separate from and 381 | independent of the terms and conditions of this Public License. 382 | 383 | 384 | Section 8 -- Interpretation. 385 | 386 | a. For the avoidance of doubt, this Public License does not, and 387 | shall not be interpreted to, reduce, limit, restrict, or impose 388 | conditions on any use of the Licensed Material that could lawfully 389 | be made without permission under this Public License. 390 | 391 | b. To the extent possible, if any provision of this Public License is 392 | deemed unenforceable, it shall be automatically reformed to the 393 | minimum extent necessary to make it enforceable. If the provision 394 | cannot be reformed, it shall be severed from this Public License 395 | without affecting the enforceability of the remaining terms and 396 | conditions. 397 | 398 | c. No term or condition of this Public License will be waived and no 399 | failure to comply consented to unless expressly agreed to by the 400 | Licensor. 401 | 402 | d. Nothing in this Public License constitutes or may be interpreted 403 | as a limitation upon, or waiver of, any privileges and immunities 404 | that apply to the Licensor or You, including from the legal 405 | processes of any jurisdiction or authority. 406 | 407 | 408 | ======================================================================= 409 | 410 | Creative Commons is not a party to its public 411 | licenses. Notwithstanding, Creative Commons may elect to apply one of 412 | its public licenses to material it publishes and in those instances 413 | will be considered the “Licensor.” The text of the Creative Commons 414 | public licenses is dedicated to the public domain under the CC0 Public 415 | Domain Dedication. Except for the limited purpose of indicating that 416 | material is shared under a Creative Commons public license or as 417 | otherwise permitted by the Creative Commons policies published at 418 | creativecommons.org/policies, Creative Commons does not authorize the 419 | use of the trademark "Creative Commons" or any other trademark or logo 420 | of Creative Commons without its prior written consent including, 421 | without limitation, in connection with any unauthorized modifications 422 | to any of its public licenses or any other arrangements, 423 | understandings, or agreements concerning use of licensed material. For 424 | the avoidance of doubt, this paragraph does not form part of the 425 | public licenses. 426 | 427 | Creative Commons may be contacted at creativecommons.org. 428 | -------------------------------------------------------------------------------- /modules.md: -------------------------------------------------------------------------------- 1 | # FPTF JavaScript modules 2 | 3 | This is a list of JavaScript modules adhering to the [*Friendly Public Transport Format*](https://github.com/public-transport/friendly-public-transport-format). 4 | 5 | - [`validate-fptf`](https://github.com/public-transport/validate-fptf) – Validate *FPTF* data. Follows the spec. 6 | 7 | ## exposing or containing FPTF data 8 | 9 | - [`db-hafas`](https://github.com/derhuerst/db-hafas) – JavaScript client for the DB HAFAS API. 10 | - [`db-prices`](https://github.com/juliuste/db-prices) – Find the cheapest routes using the DB Sparpreise API. 11 | - [`db-stations`](https://github.com/derhuerst/db-stations) – A list of DB stations. 12 | - [`vbb-monitor`](https://github.com/derhuerst/vbb-monitor) – Fetch all departures of all lines at all stations of VBB. 13 | - [`db-monitor`](https://github.com/derhuerst/db-monitor) – Fetch departures at DB stations. 14 | - [`db-monitor-cli`](https://github.com/derhuerst/db-monitor-cli) – Command line tool to fetch departures at DB stations. 15 | - [`db-zugradar-client`](https://github.com/derhuerst/db-zugradar-client) – Get live departures of DB trains. 16 | - [`oebb-hafas`](https://github.com/juliuste/oebb-hafas) – JavaScript client for the ÖBB HAFAS API. 17 | - [`deinbus`](https://github.com/juliuste/deinbus) – JavaScript client for the *deinbus* coach travel API. 18 | - [`ecolines`](https://github.com/derhuerst/ecolines) – JavaScript client for the Ecolines API. 19 | - [`eurolines-de`](https://github.com/juliuste/eurolines-de) – JavaScript client for the eurolines.de API. 20 | - [`generate-db-graph`](https://github.com/derhuerst/generate-db-graph) – Generate a JSON graph of Deutsch Bahn public transport. 21 | - [`hafas-client`](https://github.com/public-transport/hafas-client) – JavaScript client for HAFAS mobile APIs. 22 | - [`interrail`](https://github.com/juliuste/interrail) – Find european train stations and routes. Client for the European Interrail / EuRail API. 23 | - [`locomore`](https://github.com/derhuerst/locomore) – A JavaScript client for the Locomore API. 24 | - [`meinfernbus`](https://github.com/juliuste/meinfernbus) – JavaScript client for the Meinfernbus/FlixBus API. 25 | - [`nettbuss-stations`](https://github.com/derhuerst/nettbuss-stations) – A list of Nettbuss.se stations. 26 | - [`ouibus`](https://github.com/juliuste/ouibus) – JavaScript client for the OUIBUS API. 27 | - [`search-meinfernbus-locations`](https://github.com/derhuerst/search-meinfernbus-locations) – Search for Flixbus MeinFernbus cities & stations. 28 | - [`sncf`](https://github.com/juliuste/sncf) – SNCF API client 29 | - [`tallink`](https://github.com/juliuste/tallink) – JavaScript client for the tallink API. 30 | - [`vbb-client`](https://github.com/derhuerst/vbb-client) – An API client for Berlin & Brandenburg public transport. 31 | - [`vbb-fare-zones`](https://github.com/derhuerst/vbb-fare-zones) – All VBB stations and their fare zones. 32 | - [`vbb-find-stations`](https://github.com/derhuerst/vbb-find-stations) – Search for stations of VBB. 33 | - [`vbb-hafas`](https://github.com/derhuerst/vbb-hafas) – A JavaScript client for Berlin & Brandenburg public transport HAFAS API. 34 | - [`vbb-lines`](https://github.com/derhuerst/vbb-lines) – VBB lines and their stations. 35 | - [`vbb-lines-at`](https://github.com/derhuerst/vbb-lines-at) – Which lines run at a VBB station? 36 | - [`vbb-positions-stream`](https://github.com/derhuerst/vbb-positions-stream) – A realtime stream for positions of buses and trains. 37 | - [`hafas-rest-api`](https://github.com/derhuerst/hafas-rest-api) – Expose a HAFAS client via an HTTP REST API. 38 | - [`vbb-rest`](https://github.com/derhuerst/vbb-rest) – An HTTP REST server for Berlin & Brandenburg public transport. 39 | - [`db-rest`](https://github.com/derhuerst/db-rest) – A clean REST API wrapping around the Deutsche Bahn API. 40 | - [`vbb-stations`](https://github.com/derhuerst/vbb-stations) – A list of VBB stations. 41 | - [`vbb-stations-autocomplete`](https://github.com/derhuerst/vbb-stations-autocomplete) – Search for stations of VBB. 42 | - [`db-stations-autocomplete`](https://github.com/derhuerst/db-stations-autocomplete) – Search for stations of DB. 43 | - [`vbb-trips`](https://github.com/derhuerst/vbb-trips) – When do trains run where in VBB? 44 | - [`wifi-on-ice-portal-client`](https://github.com/derhuerst/wifi-on-ice-portal-client) – Query information from the WifiOnICE portal in German ICE trains. 45 | - [`insa-hafas`](https://github.com/derhuerst/insa-hafas) – JavaScript client for the NASA/INSA HAFAS API. 46 | - [`nahsh-hafas`](https://github.com/juliuste/nahsh-hafas) – JavaScript client for the NAH.SH HAFAS API. 47 | - [`hafas-monitor-departures`](https://github.com/derhuerst/hafas-monitor-departures) – Fetch all departures of all lines at all stations of VBB. 48 | - [`hafas-monitor-departures-ws-server`](https://github.com/derhuerst/hafas-monitor-departures-ws-server) – A WebSocket server wrapping `hafas-monitor-departures`. 49 | - [`hafas-monitor-journeys`](https://github.com/derhuerst/hafas-monitor-journeys) – Use any HAFAS API to monitor journeys from A to B. 50 | - [`pyhafas`](https://github.com/FahrplanDatenGarten/pyhafas/) - python client for the HAFAS API 51 | 52 | ## consuming FPTF data 53 | 54 | - [`generate-db-shop-urls`](https://github.com/derhuerst/generate-db-shop-urls) – Magically generate Deutsche Bahn ticket URLs. 55 | - [`generate-vbb-gtfs`](https://github.com/derhuerst/generate-vbb-gtfs) – Generate clean GTFS from VBB data. 56 | - [`vbb-journey-ui`](https://github.com/derhuerst/vbb-journey-ui) – UI component for displaying a journey like in Google Maps. 57 | - [`hafas-discover-stations`](https://github.com/derhuerst/hafas-discover-stations) – Pass in a HAFAS client, discover stations by querying departures. 58 | - [`discover-vbb-stations`](https://github.com/derhuerst/discover-vbb-stations) – Build a graph of VBB stations by querying departures. 59 | - [`discover-db-stations`](https://github.com/derhuerst/discover-db-stations) – Build a graph of DB stations by querying departures. 60 | - [`hafas-collect-departures-at`](https://github.com/derhuerst/hafas-collect-departures-at) – Utility to collect departures, using any HAFAS client. 61 | - [`hafas-estimate-station-weight`](https://github.com/derhuerst/hafas-estimate-station-weight) – Pass in a HAFAS client, estimate the importance of a station. 62 | - [`are-vbb-hafas-stations-the-same`](https://github.com/derhuerst/are-vbb-hafas-stations-the-same) – Check if two stations from the VBB API should be one. 63 | - [`merge-vbb-stations`](https://github.com/derhuerst/merge-vbb-stations) – Heuristic to find VBB stations & stops that should be one. 64 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "friendly-public-transport-format", 3 | "description": "A format for APIs, libraries and datasets containing and working with public transport data.", 4 | "version": "1.2.1", 5 | "keywords": [ 6 | "public transport", 7 | "transit", 8 | "gtfs", 9 | "format", 10 | "standard", 11 | "spec" 12 | ], 13 | "author": {"name": "Julius Tens", "email": "mail@juliustens.de>"}, 14 | "contributors": [ 15 | {"name": "Jannis R", "email": "mail@jannisr.de>"}, 16 | {"name": "Kilian Koeltzsch", "email": "me@kilian.io"} 17 | ], 18 | "homepage": "https://github.com/public-transport/friendly-public-transport-format", 19 | "repository": "public-transport/friendly-public-transport-format", 20 | "bugs": "https://github.com/public-transport/friendly-public-transport-format/issues", 21 | "main": "spec/readme.md", 22 | "files": [ 23 | "spec", 24 | "examples", 25 | "modules.md" 26 | ], 27 | "license": "CC-BY-SA-4.0" 28 | } 29 | -------------------------------------------------------------------------------- /spec/readme.md: -------------------------------------------------------------------------------- 1 | # friendly public transport format 2 | 3 | ## references 4 | 5 | In order to be able to use this format in both static data *and* API responses, you may choose whether to reference an item by its `id` or inline the item as an object. Take this stop as an example: 6 | 7 | ```js 8 | { 9 | type: 'stop', 10 | id: '1234', 11 | name: 'Bus Terminal A', 12 | station: '123' // this references a `station` object 13 | } 14 | ``` 15 | 16 | You may also inline the `station` if that's more convenient: 17 | 18 | ```js 19 | { 20 | type: 'stop', 21 | id: '1234', 22 | name: 'Bus Terminal A', 23 | station: { // inline `station` object 24 | type: 'station', 25 | id: '123', 26 | name: 'Copenhagen Central Station' 27 | } 28 | } 29 | ``` 30 | 31 | ## `location` objects 32 | 33 | A `location` object is used by other items to indicate their locations. 34 | 35 | ```js 36 | { 37 | type: 'location', // required 38 | name: 'Reichstagsgebäude', // optional 39 | address: 'Platz der Republik 1, 11011 Berlin', // optional 40 | 41 | longitude: 13.4, // optional 42 | latitude: 52.5, // optional 43 | altitude: 130.5 // optional, in meters 44 | } 45 | ``` 46 | 47 | If the `latitude` field is specified in a `location` object, the `longitude` field must also be specified, and vice-versa. 48 | 49 | ## item types 50 | 51 | ### `station` 52 | 53 | A station is a larger building or area that can be identified by a name. It is usually represented by a single node on a public transport map. Whereas a `stop` usually specifies a location, a `station` often is a broader area that may span across multiple levels or buildings. 54 | 55 | ```js 56 | { 57 | type: 'station', // required 58 | id: '123456', // unique, required 59 | name: 'Berlin Hauptbahnhof', // official non-abbreviated name, required 60 | // todo: other names 61 | location: { // location object, optional 62 | // … see above 63 | }, 64 | regions: [ // region ids or region objects, see the section on 'region's, optional 65 | '1234', '2345' 66 | ] 67 | } 68 | ``` 69 | 70 | ### `stop` 71 | 72 | A stop is a single small point or structure at which vehicles stop. A stop always belongs to a station. It may for example be a sign, a basic shelter or a railway platform. 73 | 74 | If the underlying data source does not allow such a fine-grained distinction, use `station`s instead. 75 | 76 | ```js 77 | { 78 | type: 'stop', // required 79 | id: '12345678', // unique, required 80 | station: '123456', // station id or station object, required 81 | name: 'Berlin Hauptbahnhof (tief)', // official non-abbreviated name, required 82 | // todo: other names 83 | location: { // location object, optional 84 | // … see above 85 | } 86 | } 87 | ``` 88 | 89 | ### `region` 90 | 91 | A `region` is a group of `station`s, for example a metropolitan area or a geographical or cultural region. 92 | 93 | In many urban areas, there are several long-distance train & bus stations, all distinct but well-connected through local public transport. It makes sense to keep them as `station`s, because they may still have individual `stop`s, but clustering them enables more advanced routing information. 94 | 95 | A `station` can be part of multiple `region`s. 96 | 97 | ```js 98 | { 99 | type: 'region', // required 100 | id: '1234', // unique, required 101 | name: 'Bretagne', // official non-abbreviated name, required 102 | // todo: other names 103 | stations: [ // station ids or station objects, required 104 | '123456', '234567' 105 | ] 106 | } 107 | ``` 108 | 109 | ### `line` 110 | 111 | ```js 112 | { 113 | type: 'line', // required 114 | id: '123', // unique, required 115 | name: 'ICE 599', // official non-abbreviated name, required 116 | mode: 'train', // see section on modes, required 117 | subMode: …, // reserved for future use 118 | // todo: color, ... 119 | routes: [], // array of route ids or route objects 120 | operator: '123456', // operator id or operator object 121 | } 122 | ``` 123 | 124 | ### `route` 125 | 126 | A route represents a single set of stations, of a single `line`. 127 | 128 | For a very consistent subway service, there may be one route for each direction. Planned detours, trains stopping early and additional directions would have their own route. 129 | 130 | ```js 131 | { 132 | type: 'route', // required 133 | id: '1234', // unique, required 134 | line: '123', // line id or line object, required, 135 | mode: 'bus', // see section on modes, overrides `line` mode, e.g. for replacements services 136 | subMode: …, // reserved for future use 137 | stops: [ // array of stop/station ids or objects, required 138 | '12345678', 139 | '87654321' 140 | ] 141 | } 142 | ``` 143 | 144 | ### `schedule` 145 | 146 | *Note:* There are many ways to format schedules of public transport routes. This one tries to balance the amount of data and consumability. It is specifically geared towards urban public transport, with frequent trains and homogenous travels. 147 | 148 | ```js 149 | { 150 | type: 'schedule', // required 151 | id: '12345', // unique, required 152 | route: '1234', // route id or object, required 153 | mode: 'bus', // see section on modes, overrides `route`/`line` mode, e.g. for replacements services 154 | subMode: …, // reserved for future use 155 | sequence: [ 156 | // seconds relative to departure at first station/stop 157 | // in 1-to-1 relation to `route` stops 158 | { 159 | arrival: -30 // optional, when the vehicle enters the route 160 | // The departure at the first stop must be 0. 161 | departure: 0 // required 162 | }, 163 | { 164 | arrival: 50, // optional 165 | departure: 70 // required 166 | } 167 | { 168 | arrival: 120, // The arrival at the last stop is required. 169 | departure: 150 // optional, when the vehicle leaves the route 170 | } 171 | ], 172 | starts: [ // array of Unix timestamps, required 173 | 1488379661, // start time of the trip 174 | 1488379761, 175 | 1488379861, 176 | 1488379961 177 | ] 178 | } 179 | ``` 180 | 181 | ### `operator` 182 | 183 | ```js 184 | { 185 | type: 'operator', // required 186 | id: 'sncf', // unique, required 187 | name: 'Société nationale des chemins de fer français' // official non-abbreviated name, required 188 | } 189 | ``` 190 | 191 | ### `stopover` 192 | 193 | A `stopover` represents a vehicle stopping at a stop/station at a specific time. 194 | 195 | ```js 196 | { 197 | type: 'stopover', // required 198 | 199 | // - stop/station id or object 200 | // - required 201 | stop: '12345-678', 202 | 203 | // - ISO 8601 string (with stop/station timezone) 204 | // - required if `departure` is null 205 | arrival: '2017-03-17T15:00:00+02:00', 206 | 207 | // - seconds relative to scheduled arrival 208 | // - optional 209 | arrivalDelay: -45, 210 | 211 | arrivalPlatform: '4-1', // string, optional 212 | 213 | // - ISO 8601 string (with stop/station timezone) 214 | // - required if `arrival` is null 215 | departure: '2017-03-16T20:00:00+01:00', 216 | 217 | // - seconds relative to scheduled departure 218 | // - optional 219 | departureDelay: 120, 220 | 221 | departurePlatform: null, // string, optional 222 | } 223 | ``` 224 | 225 | ### `journey` 226 | 227 | A `journey` is a computed set of directions to get from A to B at a specific time. It would typically be the result of a route planning algorithm. 228 | 229 | ```js 230 | { 231 | type: 'journey', // required 232 | id: '12345', // unique, required 233 | legs: [ // array of objects, required 234 | { 235 | // - station/stop/location id or object 236 | // - required 237 | origin: '12345678', 238 | 239 | // station/stop/location id or object 240 | // - required 241 | destination: '87654321', 242 | 243 | // - ISO 8601 string (with origin timezone) 244 | // - required 245 | departure: '2017-03-16T20:00:00+01:00', 246 | 247 | // - seconds relative to scheduled departure 248 | // - optional 249 | departureDelay: 120, 250 | 251 | departurePlatform: '4-1', // string, optional 252 | 253 | // - ISO 8601 string (with destination timezone) 254 | // - required 255 | arrival: '2017-03-17T15:00:00+02:00', 256 | 257 | // - seconds relative to scheduled arrival 258 | // - optional 259 | arrivalDelay: -45, 260 | 261 | arrivalPlatform: '9', // string, optional 262 | 263 | // - array of stopover objects 264 | // - optional 265 | stopovers: […], 266 | 267 | // - schedule id or object 268 | // - optional 269 | schedule: '1234', 270 | 271 | // - see section on modes 272 | // - overrides `schedule`'s `mode` 273 | mode: 'train', 274 | 275 | subMode: …, // reserved for future use 276 | 277 | public: true, // is it publicly accessible? 278 | 279 | // - operator id or object 280 | // - overrides `schedule`'s `operator` 281 | operator: 'sncf' 282 | 283 | // use this if pricing information is available for specific legs 284 | price: { // optional 285 | amount: 12.50, // number, required 286 | currency: 'EUR' // ISO 4217 code, required 287 | } 288 | } 289 | // … 290 | ], 291 | price: { // optional 292 | amount: 19.95, // number, required 293 | currency: 'EUR' // ISO 4217 code, required 294 | } 295 | } 296 | ``` 297 | 298 | The `departureDelay` and `arrivalDelay` fields should only contain a value if realtime data or a prognosis based on realtime data is actually available. 299 | 300 | ## modes 301 | 302 | As discussed in [#4](https://github.com/public-transport/friendly-public-transport-format/issues/4), we decided to have two fields `mode` and `subMode`. 303 | 304 | The following list shows all possible values for a `mode` property. For consumers to be able to use `mode` meaningfully, we will keep this list very short. 305 | 306 | - `train` 307 | - `bus` 308 | - `watercraft` 309 | - `taxi` 310 | - `gondola` 311 | - `aircraft` 312 | - `car` 313 | - `bicycle` 314 | - `walking` 315 | 316 | In order to convey more details, we will add the `subMode` field in the future. It will differentiate means of transport in a more fine-grained way, in order to enable consumers to provide more context and a better service. 317 | --------------------------------------------------------------------------------