# Package com.codename1.maps.routing

package com.codename1.maps.routing

Road-following routes for the modern maps API.

A `Polyline` connects the coordinates you hand it with straight segments, which is rarely what a navigation screen wants. This package works out the geometry of the roads between two points so the line on the map traces the drive a user would actually make.

`Routing` is the entry point and works with no configuration -- it routes over OpenStreetMap data through the keyless `OsrmRouteService`, mirroring how `MapView` draws the keyless OpenFreeMap basemap:

    MapView map = new MapView();
    Routing.showRoute(map, origin, destination);

A `RouteRequest` adds waypoints and a `TravelMode`; the resulting `Route` carries the drawable geometry, the total distance and duration, and the `RouteLeg`/`RouteStep` breakdown behind a turn-by-turn list.

The default service is backed by OSRM's public demo server, which is fine for development but has no SLA. Production apps point it at their own instance, or install a different backend entirely by implementing `RouteService` and passing it to `Routing.setService(RouteService)` -- app code that calls `Routing` is unaffected either way.

- Related Packages
  Package
  Description
  com.codename1.maps
  The mapping API allows developers to use maps in their applications, add layers on top of the map and to enhance the API with additional Layers, Providers and functionality.
  com.codename1.maps.layers
  The Layers are elements that are displayed on the map.
  com.codename1.maps.providers
  These are the map providers, currently http://www.openstreetmap.org/ is supported.
  com.codename1.maps.spi
  The maps service-provider interface (SPI).
  com.codename1.maps.vector
  The pure-vector map rendering engine that backs `MapView`.
- Class
  Description
  OsrmRouteService
  The keyless `RouteService` Codename One uses by default: routing over the OpenStreetMap road network through the OSRM HTTP API.
  Route
  A road-following journey returned by a `RouteService`: the geometry that traces the actual roads, how long it is, how long it takes, and the legs and turn-by-turn steps that make it up.
  RouteCallback
  Receives the outcome of a routing request.
  RouteLeg
  The portion of a `Route` between two consecutive stops.
  RouteRequest
  Describes the journey to route: where it starts, where it ends, anything it must pass through on the way, and how the traveller moves.
  RouteService
  A backend that turns a `RouteRequest` into road-following `Route`s.
  RouteStep
  One maneuver of a `RouteLeg` -- "turn left onto Elm Street and continue for 300 m" -- together with the piece of road geometry it covers.
  Routing
  The entry point for road-following routes.
  TravelMode
  How the traveller moves, which decides the road network and speeds a `RouteService` routes over.