Routing Engine

Routing Engine

The Geobase Routing Engine provides a powerful turn-by-turn routing API to calculate routes for various modes of transportation.

API Endpoint

The Routing Engine exposes a single POST endpoint for calculating routes:

https://services.geobase.app/routing-engine/v1/route

You must provide an API key with each request. It can be either as the query parameter apikey or the header apikey. This is your Geobase Organization Services API key, under the “Services” tab in your organization.

Request Body

To calculate a route, you send a JSON object in the request body with the following parameters:

RouteRequest Schema

ParameterTypeDescriptionRequired
locationsarrayAn array of two or more Location objects to visit in order.Yes
costingstringThe costing model to use: auto, bicycle, pedestrian, truck, bus, motor_scooter, motorcycle, taxi.Yes
unitsstringDistance units for output: kilometers or miles. Default: kilometersNo
languagestringThe language for narration instructions (e.g., en-US).No
directions_typestringLevel of detail for directions: none, maneuvers, or instructions. Default: instructionsNo
idstringAn identifier to name the route request. Will be returned as-isNo

Location Object

ParameterTypeDescriptionRequired
latnumberLatitude of the location in degrees.Yes
lonnumberLongitude of the location in degrees.Yes
typestringType of location: break (default), through, via, or break_through. Details in next sectionNo
streetstringStreet name to assist in finding the correct routing location.No

Location types

Each location type controls two characteristics: whether or not to allow a u-turn at the location and whether or not to generate guidance (legs at the location, and arrival/departure maneuvers). The default is break, and the types of the first and last locations are ignored and are treated as breaks.

Location TypeDescription
breaku-turns allowed, guidance generated.
throughno u-turns, no guidance, just pass through.
viau-turns allowed, no guidance.
break_throughno u-turns, but generate guidance.

Example Request

Here is an example of how to request a route for a car between two points:

curl -X POST 'https://services.geobase.app/routing-engine/v1/route?apikey=YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
  "locations": [
    { "lat": 50.7487, "lon": 7.1374 },
    { "lat": 50.7406, "lon": 7.0995 }
  ],
  "costing": "auto",
  "units": "kilometers"
}'

Response Structure

The API returns a RouteResponse object containing the calculated trip details.

RouteResponse Schema

ParameterTypeDescription
tripTripContains the full details of the route.

Trip Object

A trip contains one or more legs. For n number of break locations, there are n-1 legs. Through locations do not create separate legs.

Each leg of the trip includes a summary, which is comprised of the same information as a trip summary but applied to the single leg of the trip. It also includes a shape, which is an encoded polyline of the route path (with 6 digits decimal precision), and a list of maneuvers as a JSON array. For more about decoding route shapes, see these code examples.

ParameterTypeDescription
legsarrayAn array of Leg objects, one for each segment between break locations.
summarySummaryA summary of the entire trip (total time, distance, etc.).
statusintegerStatus code for the request.

Leg Object

Each Leg represents a portion of the trip and contains:

ParameterTypeDescription
maneuversarrayAn array of Maneuver objects with turn-by-turn instructions.
shapestringAn encoded polyline (6-digit precision) representing the route geometry.
summarySummaryA summary of this specific leg.

Maneuver Object

The Maneuver object provides detailed instructions for each step of the route.

ParameterTypeDescription
instructionstringWritten maneuver instruction.
timenumberEstimated time for the maneuver in seconds.
lengthnumberLength of the maneuver in the specified units.
travel_modestringThe mode of travel (e.g., drive, walk).