Skip to content

Citymapper ​

Citymapper is a public transport and urban navigation app. Protocol Launcher allows you to generate official Citymapper directions links.

Usage ​

There are two ways to use this library:

  • On-Demand import from subpaths enables tree-shaking and keeps bundles small.
  • Full Import from the root package is convenient but includes all app modules.

Pick On-Demand for production builds; Full Import is fine for quick scripts or demos.

Select Installation Method

On-Demand
Recommended. Optimized for production.
Full Import
Convenient. Good for quick scripts.

Notes ​

Citymapper documents endcoord as the required destination coordinate, formatted as latitude,longitude. endname and endaddress are optional destination details. startcoord, startname, and startaddress use the same format for an explicit start point.

arrivalTime maps to Citymapper's documented arrival_time parameter and should be an ISO-8601 date/time string. Citymapper's page also mentions the older arriveby parameter as deprecated, so this module only exposes arrivalTime.

For x-callback-url links, xSource and xSuccess serialize to the official x-source and x-success parameters.

Web Directions ​

On-Demand
ts
import { webDirections } from 'protocol-launcher/citymapper'

const url = webDirections({
  endcoord: '51.537060,-0.079179',
  endname: 'The Proud Archivist',
  endaddress: '2-10 Hertford Road, London, N1 5ET',
})

Native Directions ​

On-Demand
ts
import { directions } from 'protocol-launcher/citymapper'

const url = directions({
  endcoord: '51.537060,-0.079179',
  endname: 'The Proud Archivist',
  endaddress: '2-10 Hertford Road, London, N1 5ET',
})

Directions With Arrival Time ​

On-Demand
ts
import { directions } from 'protocol-launcher/citymapper'

const url = directions({
  startcoord: '51.500729,-0.124625',
  startname: 'Westminster',
  startaddress: 'London SW1A 0AA',
  endcoord: '51.537060,-0.079179',
  endname: 'The Proud Archivist',
  endaddress: '2-10 Hertford Road, London, N1 5ET',
  arrivalTime: '2016-08-06T21:00+01:00',
})

X-Callback Directions ​

On-Demand
ts
import { xCallbackDirections } from 'protocol-launcher/citymapper'

const url = xCallbackDirections({
  endcoord: '51.537060,-0.079179',
  endname: 'The Proud Archivist',
  endaddress: '2-10 Hertford Road, London, N1 5ET',
  xSource: 'My App Name',
  xSuccess: 'myappscheme://',
})

Official Documentation ​