A Directions API is a geolocation service that software developers can use to plot routes between places on a map. Directions APIs make it easy for developers to create rich, interactive, location-based products and applications, and make the world a more connected place, whether a user is planning a trip to Bali or trying to locate an after-hours dentist. Users can search for directions for different transportation modes including driving, walking, cycling, and even link it to bus and other public transportation routes.
Some popular Directions APIs are offered by Google, Mapbox, GraphHopper and MapQuest.
How Does a Directions API Work?
Requests to a Directions API are usually constructed as a URL, with start and destination location coordinates (latitude and longitude), and some form of credential (usually an API key) as input parameters. Some Directions APIs also offer various optional parameters you can add to a request, e.g. type of vehicle you are driving or the time of day you will be traveling, and factors that may affect your journey, which the API will take into consideration when assembling your directions.
A typical response from a Directions API returns driving directions and may contain other pertinent information, which can be displayed in table, dialog and graph map overlays:
Type of waypoint, e.g. bus station or point of interest
Start address and end address, including location coordinates
One or more possible routes and their distances, including route optimization details
Speed and journey duration for a specified mode of transport and calculated ETA
Types of roads, e.g. toll or motorway
Information about traffic congestion or accident warnings
Voice instructions for drivers in a specified language
Mapping absolute location data: converting GPS coordinates into street directions
Customer support: predicting delivery and pickup times
Sales conversions: optimizing routes to local stores
Travel and tourism: plotting global routes
Event support: suggesting transport options for event-goers to attend concerts
Disaster management: identifying the extent of a disaster and the risks to locations in close proximity
Connected cars: providing direction information for intelligent vehicles
Timetables: public transport journey durations
MORE FROM PUBNUB
Geolocation Tracking Tutorial
In this tutorial you’ll discover how to build a geolocation tracking app that allows users to share locations and send messages in real-time.