PubNub Integration

Mapbox: Directions

Data Streaming & Dashboards

Data Streaming & Dashboards

Geolocation

Geolocation

Last Updated:

2016/09/19

Author:

PubNub

Mapbox Signup

Turn-by-turn traffic-aware directions and ETAs, including driving, walking, and cycling

Mapbox's Directions provides a variety of traffic-aware navigation features, including walking, driving, and cycling directions, ETAs, alternative routes, and turn-by-turn instructions, all laid upon Mapbox's beautiful selection of vector maps.

The Mapbox Directions block, you can build traffic-aware directions and navigation into your realtime applications. For example, if you're building a taxi or ridesharing application, the block lets you stream geolocation coordinates data between users (like a driver and passenger), then provide navigation to connect them. Or for a delivery app, you can send drop off locations to a fleet of trucks based on their current coordinates.

Walkthrough

The block requires five inputs: two pairs of latitude, longitude and the type of desired transportation method. Once the response comes from Mapbox, the block appends the directions into the message payload.

Input

Input Channel: mapbox-directions-channel (configurable)lat1lng1 is the origin coordinateslat2lng2 is the destination coordinatesprofile represents the type of transporation: mapbox/driving, mapbox/cycling or mapbox/walking

{
    "lat1": 10,
    "lng1": 11,
    "lat2": 15,
    "lng2": 20,
    "profile": "mapbox/driving"
}

Output

The block appends the directions returned by the Mapbox Directions API into the message payload. Please refer to the Mapbox documentation for field information.

{
    "lat1": 10,
    "lng1": 11,
    "lat2": 15,
    "lng2": 20,
    "profile": "mapbox/driving",
    "directions": <Mapbox Directions API Response>
}

Feedback & Support

Need help? Contact PubNub Support.


Talk to an expert

Contact Sales