OpenRouteService - green-ecolution/backend GitHub Wiki

Efficient route planning

OpenRouteService (ORS) is an open-source routing service that provides various navigation and geospatial analysis tools. It allows users to calculate routes for different modes of transportation (e.g., car, bike, foot) and offers features like distance matrices, isochrones (travel-time polygons), and elevation data.

Key features

  • Multi-modal routing: Supports driving, cycling, walking, public transport, and wheelchair-accessible routes.
  • Customizable routing: Adjust routes based on preferences like fastest, shortest, or avoiding toll roads and highways.
  • Turn-by-turn directions: Provides detailed navigation instructions.
  • Uses OpenStreetMap (OSM) data, allowing self-hosting for privacy or specialized needs.

Local Deployment

To set up a local environment to work with our system, spin up a container as described here: openrouteservice#installation

Let's assume that we set up valhalla in a Docker Compose file like this:

#! .docker/docker-compose.infra.yaml

services:
  # [...]
ors-app:
    image: openrouteservice/openrouteservice:v9.0.0
    ports:
      - "8080:8082"
      - "9001:9001"
    user: "1000:1000" # Default is 1000:1000. make infra/up will override this to the actual user values
    volumes:
      - ./infra/ors:/home/ors
    environment:
      ors.engine.profile_default.build.source_file: /home/ors/files/sh.osm.pbf
      REBUILD_GRAPHS: false
      CONTAINER_LOG_LAVEL: INFO
      XMS: 256m
      XMX: 512m
      ADDITIONAL_JAVA_OPTS: ""
    deploy:
      resources:
        reservations:
          cpus: "1"
          memory: 256m
        limits:
          cpus: "1"
          memory: 512m
    networks:
      - app-network

OpenRouteService can used to calculate a route and Vroom to optimize it. For further configuration information refer to Vroom. For more details to Openrouteservice, visit the official repository

Then the Green Ecolution configuration would look like this:

#! config/config.<env>.yaml
routing:
    start_point:
        - 9.434764259345679
        - 54.768731253913806
    end_point:
        - 9.434764259345679
        - 54.768731253913806
    watering_point:
        - 9.434764259345679
        - 54.768731253913806
    ors:
        host: http://localhost:8080/ors
        optimization:
            vroom:
                host: http://localhost:2525

start_point, end_point and watering_point are needed to optimize the route with Vroom.

Differences between Valhalla and ORS

While Valhalla is highly dynamic and supporting on-the-fly route calculations with minimal preprocessing on the opposite site ORS requires more preprocessing, meaning changes to routing data take longer to propagate.

A small comparison:

Feature Valhalla ORS
Dynamic Costing ✅ Yes ❌ No
Elevation Data ✅ Yes ✅ Yes
Turn-by-turn Navigation ✅ Yes ✅ Yes
Matrix API ✅ Yes ✅ Yes
Isochrone API ✅ Yes ✅ Yes
Customizable Profiles ✅ Yes ✅ Limited
MLive Traffic Support ✅ Yes ❌ No
⚠️ **GitHub.com Fallback** ⚠️