Skip to content

Moovit

Moovit is a public transit app. Protocol Launcher allows you to generate Moovit URL Scheme 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

This module only exposes the actions listed by Moovit's official deeplinking documentation: nearby, directions, the iOS/Android fallback links, and the documented download link.

The payloads use Moovit's documented parameter names, including partner_id, dest_lat, dest_lon, orig_lat, orig_lon, and auto_run. date should be an ISO-8601 date/time string.

Nearby Transit

On-Demand
ts
import { nearby } from 'protocol-launcher/moovit'

const url = nearby({
  lat: 40.758896,
  lon: -73.98513,
  partner_id: 'YOUR_APP_NAME',
})

Directions

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

const url = directions({
  dest_lat: 40.758896,
  dest_lon: -73.98513,
  dest_name: 'Times Square',
  partner_id: 'YOUR_APP_NAME',
})

Directions With Origin and Date

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

const url = directions({
  dest_lat: 40.758896,
  dest_lon: -73.98513,
  dest_name: 'Times Square',
  orig_lat: 40.735845,
  orig_lon: -73.990512,
  orig_name: 'Union Square',
  auto_run: true,
  date: '2019-04-01T18:30:00+02:00',
  partner_id: 'YOUR_APP_NAME',
})
On-Demand
ts
import { iosFallbackLink } from 'protocol-launcher/moovit'

const url = iosFallbackLink({
  c: 'YOUR_APP_NAME',
  af_dp: 'moovit://nearby?lat=40.758896&lon=-73.98513&partner_id=YOUR_APP_NAME',
})
On-Demand
ts
import { androidFallbackLink } from 'protocol-launcher/moovit'

const url = androidFallbackLink({
  c: 'YOUR_APP_NAME',
  af_dp: 'moovit://nearby?lat=40.758896&lon=-73.98513&partner_id=YOUR_APP_NAME',
})
On-Demand
ts
import { downloadLink } from 'protocol-launcher/moovit'

const url = downloadLink({
  c: 'YOUR_APP_NAME',
})

Official Documentation