Position-lab

Routes API

An API to plan your trips

The Routes API assists in planning the most optimal route between two points, whether traveling by foot, car, bicycle, or public transit.

About Routes API

he Routes API is a big help when you’re trying to find the best way to get from A to B. You just put in your starting point and where you want to go, which can be either coordinates or addresses, and any preferences you have for your trip. For example, you can add in stops you want to make along the way, set how you’re traveling, give a departure or arrival time you’re aiming for, and let it know if you’re okay with taking toll roads to get there a bit faster. When the API gets back to you, you’ll have a few different routes to choose from, and it takes into account things like accidents, roadwork, closures, and offers options for different modes of transport to get there.

API Request

API Output

Steps to get routes data

3

3

2

1

First thing you need is a unique API key. Choose one from one of our pricing plans and get an email instantly with your API key. 

To authenticate and gain access to the Geocoding API, all you need to do is attach your key to the base endpoint URL. 

https://api.position-lab.com/routes?key=API_KEY

Use the”address_start/end” or “coordinates_start/end”  parameters to plan the route.

Enjoy the data!

				
					{
"geo_waypoints":
[
{
"status": "OK",
"location_id": "ChIJ9h21D60Fbg0R_t11auhbb8Z",
"types": ["locality", "political"]
},
{
"status": "OK",
"location_id": "ChIJhSwKgZvpQg0XbKMYdHePsR",
"types": ["locality", "political"]
}
],
"routes":
[
{
"bounds":
{
"northeast": { "lat": 42.4165207, "lng": -2.7026134 },
"southwest": { "lat": 41.862808, "lng": -3.029406799999999 }
},
"legs":
[
{
"distance": { "text": "95.3 km", "value": 95327 },
"duration": { "text": "65 mins", "value": 3890 },
"address_end": "Barcelona, Spain",
"location_end": { "lat": 42.4165207, "lng": -2.705076 },
"address_start": "Valencia, Spain",
"location_start": { "lat": 41.862808, "lng": -3.0273727 },
"steps":
[
{
"distance": { "text": "1.6 km", "value": 1615 },
"duration": { "text": "4 mins", "value": 245 },
"end_location":
{ "lat": 41.8681019, "lng": -3.029378299999999 },
"instructions": "Head <b>northeast</b> on <b>Av. de las Naciones</b> toward <b>C. de la Union</b>",
"polyline":
{
"points": "abcdFefgHJIJLJn@PQFg@Ni@JeBh@}@XaD|@{@Vk@Ns@RUFoA^u@R_AXwA@WHMBG@C?E?GAC?IC"
},
"location_start": { "lat": 41.862808, "lng": -3.0273727 },
"travel_mode": "DRIVING"
},
{
"distance": { "text": "2.2 km", "value": 2174 },
"duration": { "text": "2 min", "value": 130 },
"location_end": { "lat": 41.8675297, "lng": -3.0275807 },
"instructions": "At the circle, continue onto <b>C. Marquis de Riscal</b>",
"maneuver": "straight",
"polyline":
{
"points": "efghFr~hW?AAEAEACACACCCACF_@H[FQNi@j@cB`@qAHW"
},
"start_location":
{ "lat": 41.8681019, "lng": -3.029378299999999 },
"travel_mode": "DRIVING"
..............
.........
.....
}
]
}
]
				
			

Routes API in practice

Enriching Navigation

Route APIs ensure efficient navigation by offering the fastest paths and alternative routes during disruptions, like traffic jams or road closures.

Streamlining Logistics

This API optimizse the delivery routes and manage time windows, enhancing the reliability of transport and logistics companies by providing the most economical routes and accurate ETAs.

Crafting Tourist Trails

Beyond basic navigation, Route APIs in travel apps create thematic routes, weaving through tourist attractions and integrating public transport options.

Revamping Ride-Shares

In ride-sharing, Route APIs automatically plan optimal paths for pick-ups and drop-offs and compute ride costs based on travel estimates.

Smart E-commerce Deliveries

For e-commerce, Route APIs plan the most efficient delivery routes, considering multiple drop-off points to ensure timely home deliveries.