Seatmap

Seatmap consists of two parts, a REST API for administration/configuration of seat maps and an API for fetching seat map images. For Seatmap to work the seat allocation system Plads90 must be set up and the railcar identification 'litra' must be the same in Plads90 as in Seatmap.

Authentication

Seatmap requires a Bearer Token in the Authorization header created by the Entur Authentication server for every request.

Seatmap API

Seatmap API are services for fetching metadata and images for seat maps. The image formats supported is PNG (raster image) and SVG (Scalable Vector Graphics).

Guides

Table of Contents

  1. Prerequisites
  2. Seatmap API
    1. Usage
    2. API
    3. Example

Prerequisites

For Seatmap to work the seat allocation system Plads90 must be set up and the railcar identification 'litra' must be the same in Plads90 as in Seatmap.

Seatmap API

The three services in this API are used by agents and operators to fetch metadata and images for seatmaps.

Usage

The first step when starting to use Seatmap API is to call get /api/railcar_sets/YOUR-SETCODE/railcars, this call will make Seatmap generate all images needed. The response will list all railcars, with matadata and image path, in the railcar set and all railcar elements for each railcar, also with metadata and paths to images. Railcar elements with the "seat" parameter set to true will have links to images/icons for each status(FREE, CHOSEN, UNAVAILABLE, CONFIRMED AND CONFLICT).

Next step is to call get /api/railcar_sets/YOUR-SETCODE/railcars/LITRA with train number and from station number/NRS code ('NSR:StopPlace:609' - Kristiansand) as request parameters to get information about wanted railcar and it's railcar elements.

Then a call to get /api/railcar_sets/YOUR-SETCODE/railcars/LITRA.png with the same request parameters as above to get the "base image" for the wanted railcar.

The reason for giving train number and from station number/NSR code is the possibility that one or both of them are included in a train exception rule or a station exception rule. Train exception rules contains information whether an interval of train numbers (a line) have seatmaps enabled and whether that line have flip direction of seatmap for railcar enabled. Station exception rules tells whether flip direction of seatmap for railcar should be implementet on this station (i.e. Kristiansand where the train arrives the station in one direction and leaves in the other direction even though it's not a terminus).

Combined with information about seat availability for a given railcar on an given departure and "base image", seatnumber, position x, position y and wanted image/icon based on seat status from Seatmap a complete seatmap can be made.

API

Example

Step by step example:

  1. Call get /api/railcar_sets/Entur_v1/railcars to get information about railcars in set and if first call get Seatmap to generate images.

  2. Call get /api/railcar_sets/Entur_v1/railcars/BPA75 to get information about railcar with litra 'BPA75', see complete response below

  3. Call get /api/railcar_sets/Entur_v1/railcars/BPA75.png to get the "base image" for railcar with litra 'BPA75'.

Test

  1. External information all seats excluding seat number 44, 45, 49 and 50 are free, and the four mentioned are unavailable.

  2. Combine step 2, 3 and 4 to generate seatmap for railcar with litra 'BPA75''.

    1. "Base image" as first layer.

    2. For each railcar element use seatNumber, positionX and positionY (where x 0 and y 0 is top left corner) with external seat status information and wanted icon to put icon on top of "base image".

      1. Seat 44 is unavailable -> place icon from imageUrlPathUnavailable (/images/seatmaps/1/REAR_FACING_SEAT$UNAVAILABLE_15x21.png?sec=1461251324)
      on coordinates x=74 and y=143.
      
      2. Seat 45 is unavailable -> place icon from imageUrlPathUnavailable (/images/seatmaps/1/REAR_FACING_SEAT$UNAVAILABLE_15x21.png?sec=1461251324)
      on coordinates x=58 and y=143.
      
      3. Seat 46 is free -> place icon from imageUrlPath (/images/seatmaps/1/REAR_FACING_SEAT$FREE_15x21.png?sec=1453291355)
      on coordinates x=35 and y=143.
      
      4. Etc.
      
  3. Final result should then look like this

Test

Railcar BPA75 response

API Reference

See the API reference on the Swagger Petstore - production

See the API reference on the Swagger Petstore - staging

Swagger API reference - production

Swagger API reference - staging

Staging