Skip to content

Getting Static Data

Robin Appels edited this page Jun 26, 2019 · 10 revisions

We've created several endpoints that allow retrieving static data from the MySQL database, for example to use it in the front-end. The endpoints are accessible through http://18.224.29.151:5000. The possible endpoints are:

  • get-stops, to get a list of one or more stops and their information.
  • get-lines, to get information about one or more lines.
  • get-line-stops, to get a list of stops a line passes through.

get-stops

Parameters

  • stop_code (string): The internal stop code of a stop. Multiple stop codes are comma-separated.
  • lat (string): The latitude of a stop. Multiple latitudes are comma-separated.
  • lon (string): The longitude of a stop. Multiple longitudes are comma-separated.
  • town (string): The town in which a stop is located. Multiple cities are comma-separated.
  • district (string): The district (stadsdeel) in which a stop is located. Multiple cities are comma-separated. Not every town is part of a district.
  • area_code (string): The area code of a stop. Multiple area codes are comma-separated (NB not every stop has an area code!).
  • wheelchair (boolean): Whether the stop(s) is/are wheelchair accessible.
  • visual (boolean): Whether the stop(s) is/are visually accessible.

Examples

  • http://18.224.29.151:5000/get-stops?town=amsterdam to get all stops in Amsterdam.
  • http://18.224.29.151:5000/get-stops?town=amsterdam,weesp,diemen to get all stops in Amsterdam, Weesp and Diemen.
  • http://18.224.29.151:5000/get-stops?town=amsterdam&wheelchair=true to get all stops in Amsterdam that are wheelchair accessible.

Returns

A list containing one or more stops.

Example output

http://18.224.29.151:5000/get-stops?stop_code=30000001

[
    {
        "stop_code": "30000001",
        "lat": "52.36133",
        "lon": "4.9328747",
        "stop_name": "Muiderpoortstation",
        "town": "Amsterdam",
        "area_code": "00001",
        "access": {
            "wheelchair": 0,
            "visual": 1
        },
        "district": "Oost"
    }
]

Further Improvements

We are looking into the possibility to get stops based on their name.

get-lines

Parameters

  • operator (string): The operator of that line. Multiple operators are comma-separated.
  • internal_id (string): The ID the operator uses for a line. Multiple IDs are comma-separated.
  • public_id (string): The public ID of a line. Multiple IDs are comma-separated.
  • direction (int): The direction of a line. 1 means the line goes to the direction following the name in the response, 2 means it goes in the opposite direction. Default is 1.
  • transport_type (string): The transport type of a line. This is either BUS, TRAM, METRO or BOAT. Multiple transport types are comma-separated.
  • total_stops (int): The total number of stops a line makes.

Examples

  • http://18.224.29.151:5000/get-lines?operator=GVB to get all lines operated by GVB.
  • http://18.224.29.151:5000/get-lines?operator=GVB&transport_type=BUS,TRAM to get all bus and tram lines operated by GVB.
  • http://18.224.29.151:5000/get-lines?public_id=22 to get all lines with public ID '22'.
  • http://18.224.29.151:5000/get-lines?public_id=22&operator=GVB to get all lines with public ID '22' operated by GVB.

Returns

A list containing one or more lines.

Example output

http://18.224.29.151:5000/get-lines?operator=GVB&internal_id=22

[
    {
        "direction": 1,
        "public_id": "22",
        "internal_id": "22",
        "num_stops": 24,
        "operator": "GVB",
        "transport_type": "BUS",
        "destination": "Muiderpoortstation",
        "line_name": "Station Sloterdijk - Muiderpoortstation"
    }
]

Further Improvements

We are looking into the possibility to get lines based on their name and destination name.

get-line-info

Parameters

  • internal_id (string): The ID the operator uses for a line. Multiple ID's are separated by comma's.
  • operator (string): The operator of the line(s). Multiple operators are separated by comma's.
  • direction (string): The direction of a line. 1 means the line goes into the direction of its given name, 2 means it goes the other way.

Examples

  • http://18.224.29.151:5000/get-line_info?internal_id=22 to get a list of all stops the line with internal ID '22' passes.
  • http://18.224.29.151:5000/get-line_info?operator=GVB&direction=1 to get a list of all stops from the GVB in direction following the name of the line.

Returns

An list containing lists of stops the requested lines passes.

Example output

http://18.224.29.151:5000/get-line_info?operator=GVB&internal_id=22

[
    [
        {
            "direction": 1,
            "stop_name": "Station Sloterdijk",
            "order_number": 1,
            "stop_code": "30002367",
            "internal_id": "22"
        },
        {
            "direction": 1,
            "stop_name": "Amsterdam, La Guardiaweg",
            "order_number": 2,
            "stop_code": "30002273",
            "internal_id": "22"
        },
        {
            "direction": 1,
            "stop_name": "Kabelweg",
            "order_number": 3,
            "stop_code": "30002065",
            "internal_id": "22"
        },
        {
            "direction": 1,
            "stop_name": "Contactweg",
            "order_number": 4,
            "stop_code": "30002259",
            "internal_id": "22"
        },
        {
            "direction": 1,
            "stop_name": "Spaarndammerdijk",
            "order_number": 5,
            "stop_code": "30002061",
            "internal_id": "22"
        },
        {
            "direction": 1,
            "stop_name": "Zaanstraat",
            "order_number": 6,
            "stop_code": "30002099",
            "internal_id": "22"
        },
        {
            "direction": 1,
            "stop_name": "Spaarndammerstraat",
            "order_number": 7,
            "stop_code": "30002170",
            "internal_id": "22"
        },
        {
            "direction": 1,
            "stop_name": "Assendelftstraat",
            "order_number": 8,
            "stop_code": "30002107",
            "internal_id": "22"
        },
        {
            "direction": 1,
            "stop_name": "Nassauplein",
            "order_number": 9,
            "stop_code": "30002111",
            "internal_id": "22"
        },
        {
            "direction": 1,
            "stop_name": "Haarlemmerplein",
            "order_number": 10,
            "stop_code": "30002113",
            "internal_id": "22"
        },
        {
            "direction": 1,
            "stop_name": "Buiten Oranjestraat",
            "order_number": 11,
            "stop_code": "30005079",
            "internal_id": "22"
        },
        {
            "direction": 1,
            "stop_name": "Buiten Brouwersstraat",
            "order_number": 12,
            "stop_code": "30005081",
            "internal_id": "22"
        },
        {
            "direction": 1,
            "stop_name": "Centraal Station",
            "order_number": 13,
            "stop_code": "57005040",
            "internal_id": "22"
        },
        {
            "direction": 1,
            "stop_name": "Prins Hendrikkade",
            "order_number": 14,
            "stop_code": "30008031",
            "internal_id": "22"
        },
        {
            "direction": 1,
            "stop_name": "Kadijksplein",
            "order_number": 15,
            "stop_code": "30008027",
            "internal_id": "22"
        },
        {
            "direction": 1,
            "stop_name": "Het Funen",
            "order_number": 19,
            "stop_code": "30008183",
            "internal_id": "22"
        },
        {
            "direction": 1,
            "stop_name": "Veelaan",
            "order_number": 20,
            "stop_code": "30008059",
            "internal_id": "22"
        },
        {
            "direction": 1,
            "stop_name": "Javaplein",
            "order_number": 21,
            "stop_code": "30008113",
            "internal_id": "22"
        },
        {
            "direction": 1,
            "stop_name": "Molukkenstraat",
            "order_number": 22,
            "stop_code": "30008129",
            "internal_id": "22"
        },
        {
            "direction": 1,
            "stop_name": "Muiderpoortstation",
            "order_number": 23,
            "stop_code": "30000001",
            "internal_id": "22"
        }
    ]
]

get-districts

Get a geojson-object containing all districts in Amsterdam.

Clone this wiki locally