Map Tile API Developer's Guide

Selecting Public Transit Stops

This article shows how to make a request with metadata parameter to get the name of a a public transit stop and make it interactive (clickable).

User story

The user wants to obtain the name of a Public Transit Stop and create a clickable area on top of it so that an interaction can be created on that area, to react to requests for additional information on the public transit stop.

Request Summary

The following list summarizes the elements required to create a request matching the user story and shows, in square brackets, how those elements are used in the example(s) below. Note that the request example also uses the authentication parameters.

Resource: maptile [maptile], see also (resource) type
URL variables: {map id} [newest], see also Requesting the Right Map Version
  {scheme} [], see also scheme
  {zoom}/{column}/{row} [16/35205/21495], see also The Mercator Projection
  {size} [256], see also size
  {format} [png8], see also format
Parameters: metadata=metaonly, see also metadata mgen=2, see also mgen


The code block below demonstrates a complete request for the public transit stop.


The image shown by this tile request not using metadata would be as follows.
Figure 1. Public Transit Map Tile
The response to the request delivers the following JSON object, where we have filtered out non-relevant information for public transit.

{ "metadata" : {
"street labels":[ ... ],
"city center labels":[],
"buildings":[ ... ],
"transit stops":[ { "name": "Stadtmitte", "bounding boxes": [ { "box 1":[ 136.50, 177.02, 14, 14 ] }, { "box 2":[ 113.22, 163.02, 60.56, 13 ] } ], "info": [ { "position": {"latitude":52.510475, "longitude":13.389920}, "official name": "Stadtmitte", "places id": "721680928", "operating hours": { "Monday":[["0:0:0","24:0:0"]], "Tuesday":[["0:0:0","24:0:0"]], "Wednesday":[["0:0:0","24:0:0"]], "Thursday":[["0:0:0","24:0:0"]], "Friday":[["0:0:0","24:0:0"]], "Saturday":[["0:0:0","24:0:0"]], "Sunday":[["0:0:0","24:0:0"]], "Holiday":[["0:0:0","24:0:0"]] }, "parking hours": { "Monday":[["0:0:0","24:0:0"]], "Tuesday":[["0:0:0","24:0:0"]], "Wednesday":[["0:0:0","24:0:0"]], "Thursday":[["0:0:0","24:0:0"]], "Friday":[["0:0:0","24:0:0"]], "Saturday":[["0:0:0","24:0:0"]], "Sunday":[["0:0:0","24:0:0"]], "Holiday":[["0:0:0","24:0:0"]] } } ]} ],
"POIs":[  ]
Out of this object there following properties are of interest to show information related to the name:
  • name: contains the name used in the map for the transit stop.
  • official name: contains the official name that must be used for the transit stop, found in the info array.
  • informal name: the name by which you can refer to the transit stop or might be known to users, when available, it can be found in the info array.

For example places where the official name and the name used in the map will differ are airports where the IATA code is used instead of the official name. See example below where the name is ERF and official name is Erfurt-Weimar-Airport.
In order to select the area where the public transit stop is located there is other properties of interest in the object:
  • bounding boxes: it contains an array of bounding boxes that can be used to select the different parts
  • box 1: this bounding box contains the icon used in the map to represent the public transit stop
  • box 2: this bounding box contains the labels attached to the icon to represent the name of the transit stop in the map

The values of the bounding boxes can be used to select a rectangular area of the tile.