public-transport / hafas-client

JavaScript client for HAFAS public transport APIs.
ISC License
269 stars 54 forks source link

journeys(): support more filters #218

Open derhuerst opened 3 years ago

derhuerst commented 3 years ago
derhuerst commented 3 years ago

STV filters

routing modes:

jnyFltrL: [
{
    "type": "GROUP",
    "mode": "INC",
    // OEV: public transport only mode
    // BIKE: bike only mode
    // WALK: walking only mode
    // CAR: car only mode
    // BIKE_OEV_WALK: "bike parking → public transport → walking" a.k.a. "bike & ride" mode
    // BIKE_OEV_BIKE: "bike → public transport → bike" a.k.a. "fahrradmitnahme" mode
    // CARPARK_OEV_WALK: "car parking → public transport → walking" a.k.a. "park & ride" mode
    // CARKISS_OEV_CARKISS: "motorail → public transport → motorail" a.k.a. "autoreisezug" mode
    // BIKESHARE_CITYBIKE: "bike sharing" mode
    // todo: "sharing" mode, with these combined:
    // GROUP_SCOOTER_SHR, GROUP_PT_SCOOTER_SHR, GROUP_SCOOTER_SHR_PT, GROUP_CAR_SHR, GROUP_PT_CAR_SHR, GROUP_CAR_SHR_PT, GROUP_CARUSO_SHR, GROUP_PT_CARUSO_SHR, GROUP_CARUSO_SHR_PT, SHORT_WALK
    "value": "OEV",
},
]

when using public transport:

jnyFltrL: [
// don't use stairs
{
    "type": "META",
    "meta": "baimAvoidStairs",
}
// don't use escalators
{
    "type": "META",
    "meta": "baimAvoidEscalator",
}
// don't use elevators
{
    "type": "META",
    "meta": "baimAvoidEscalator",
}
]

speed:

gisFltrL: [
{
    // car_speed_normal/car_speed_slow/car_speed_fast
    // bike_speed_normal/bike_speed_slow/bike_speed_fast
    // foot_speed_normal/foot_speed_slow/foot_speed_fast
    "type": "M",
    "meta": "car_speed_normal",
    "mode": "FBT", // 
},
]

max distance:

gisFltrL: [
{
    "type": "P",
    "mode": "FB",
    "profile": {
        // car: K
        // bike: B
        // foot: F
        // todo: what is P? public transport?
        "type": "K",
        "maxdist": "1000000", // in meters, 1000000 is used for "unlimited"
    },
},
]

fastest/shortest:

gisFltrL: [
{
    "type": "M",
    // car_fastest/car_shortest
    "meta": "car_fastest",
    "mode": "FBT",
},
]

// avoid motorways/highways:

gisFltrL: [
// todo: what is FB? what is T?
{
    "type": "M",
    "meta": "car_nomotorway",
    "mode": "FB",
},
{
    "type": "M",
    "meta": "car_nomotorway",
    "mode": "T",
},
]

when using bike:

gisFltrL: [
// todo: what is FB? what is T?
// to *not* prefer bike routes, remove these filters

// prefer bike routes
{
    "type": "M",
    "meta": "bike_preferbikeroute",
    "mode": "FB",
},
{
    "type": "M",
    "meta": "bike_preferbikeroute",
    "mode": "T",
},

// avoid steep ascents
{
    "type": "M",
    "meta": "bike_noascents",
    "mode": "FB",
},
{
    "type": "M",
    "meta": "bike_noascents",
    "mode": "T",
},

// avoid sections where you have to get off and push
{
    "type": "M",
    "meta": "bike_nopush",
    "mode": "FB",
},
{
    "type": "M",
    "meta": "bike_nopush",
    "mode": "T",
},
]
derhuerst commented 3 years ago

VBB filters

The term BAIM seems to come from a research project run by Forschungsinstitut Technologie-Behindertenhilfe (FTB) & RMV.

"profil: bedingt barrierefrei":

jnyFltrL: [
{
    "meta": "AddParamShowAllDetails",
    "type": "PARAM",
    "value": 1,
},
{
    "meta": "AddParamBaimprofile",
    "type": "PARAM",
    "value": "1",
},
{
    "meta": "AddParamBaimprofileTransport",
    "type": "PARAM",
    "value": "1",
},
{
    "meta": "AddParamBaimlift",
    "type": "PARAM",
    "value": "0",
},
{
    "meta": "AddParamBaimramp",
    "type": "PARAM",
    "value": "0",
},
{
    "meta": "AddParamBaimescalator",
    "type": "PARAM",
    "value": "0",
},
{
    "meta": "AddParamBaimstep",
    "type": "PARAM",
    "value": "0",
},
{
    "meta": "AddParamBaimstairs",
    "type": "PARAM",
    "value": "1",
},
]

"profil: voll barrierefrei":

jnyFltrL: [
{
    "meta": "AddParamShowAllDetails",
    "type": "PARAM",
    "value": 1,
},
{
    "meta": "AddParamBaimprofile",
    "type": "PARAM",
    "value": "0",
},
{
    "meta": "AddParamBaimprofileTransport",
    "type": "PARAM",
    "value": "0",
},
{
    "meta": "AddParamBaimlift",
    "type": "PARAM",
    "value": "0",
},
{
    "meta": "AddParamBaimramp",
    "type": "PARAM",
    "value": "0",
},
{
    "meta": "AddParamBaimescalator",
    "type": "PARAM",
    "value": "1",
},
{
    "meta": "AddParamBaimstep",
    "type": "PARAM",
    "value": "1",
},
{
    "meta": "AddParamBaimstairs",
    "type": "PARAM",
    "value": "1",
},
]

individual options:

jnyFltrL: [
// todo: what is AddParamShowAllDetails?
// todo: what is AddParamBaimprofile?

{ // when entering the vehicle, e.g. between platform & train
    "type": "PARAM",
    "meta": "AddParamBaimprofileTransport",
    // 0: completely barrier-free a.k.a. "voll barrierefrei"
    // 1: somewhat barrier-free a.k.a. "bedingt barrierefrei"
    "value": "1",
},

{
    "type": "PARAM",
    // AddParamBaimlift: allow using elevators?
    // AddParamBaimramp: allow using ramps?
    // AddParamBaimescalator: allow using escalators?
    // AddParamBaimstep: allow using a single step? (*not* when entering the vehicle)
    // AddParamBaimstairs: allow using stairs?
    "meta": "AddParamBaimstairs",
    // 0: no, use them
    // 1: yes, avoid them
    "value": "1",
},
]
derhuerst commented 3 years ago

BLS:

{
    "id": "vdmazie6wicahi4s",
    "ver": "1.26",
    "lang": "deu",
    "auth": {
        "type": "AID",
        "aid": "3jkAncud78HSoqclmN54812A"
    },
    "client": {
        "id": "HAFAS",
        "type": "WEB",
        "name": "webapp",
        "l": "vs_webapp"
    },
    "formatted": false,
    "svcReqL": [
        {
            "meth": "TripSearch",
            "req": {
                "jnyFltrL": [
                    {
                        "type": "GROUP",
                        "mode": "INC",
                        "value": "RQ_CAR_ON_TRAIN"
                    },
                    {
                        "type": "META",
                        "mode": "INC",
                        "meta": "notBarrierfree"
                    },
                    {
                        "type": "PROD",
                        "mode": "INC",
                        "value": 4863
                    }
                ],
                "getPolyline": true,
                "getPasslist": true,
                "gisFltrL": [
                    {
                        "type": "P",
                        "mode": "FB",
                        "profile": {
                            "type": "F",
                            "maxdist": "2000"
                        }
                    },
                    {
                        "type": "M",
                        "mode": "FBT",
                        "meta": "foot_speed_normal"
                    },
                    {
                        "type": "P",
                        "mode": "FB",
                        "profile": {
                            "type": "B",
                            "maxdist": "0"
                        }
                    },
                    {
                        "type": "M",
                        "mode": "FBT",
                        "meta": "bike_speed_normal"
                    },
                    {
                        "type": "M",
                        "mode": "FBT",
                        "meta": "car_speed_normal"
                    }
                ],
                "depLocL": [
                    {
                        "lid": "A=1@O=Hinterkappelen, Schlossmatt@X=7394077@Y=46968548@u=791@U=85@L=8580404@",
                        "name": "Hinterkappelen, Schlossmatt"
                    }
                ],
                "arrLocL": [
                    {
                        "lid": "A=1@O=Allmendingen b. B., Garten-C.@X=7514083@Y=46920015@u=272@U=85@L=8577023@",
                        "name": "Allmendingen b. B., Garten-C."
                    }
                ],
                "outFrwd": true,
                "liveSearch": false,
                "maxChg": "1000",
                "minChgTime": "-1",
                "getIV": true
            },
            "id": "1|12|"
        }
    ]
}
derhuerst commented 2 years ago

https://github.com/derhuerst/BahnhofsAbfahrten/pull/1 adds some documentation on these filters.