$ show GIScience/openrouteservice
Openrouteservice is a production-grade, open-source routing service built on a forked GraphHopper engine. It exposes a REST API (Spring Boot, JSON/GeoJSON/GPX) for directions, isochrones, matrix calculations, map matching, and graph export, supporting multiple transport profiles (car, foot, bike, wheelchair, heavy vehicle) with extensive customization via weightings (fastest, green, quiet, steepness, heat stress), edge filters (borders, areas, features, traffic), and real-time data integration from PostGIS. Architecturally, the project is modular: `ors-api` handles HTTP concerns and request/response DTOs, `ors-engine` contains the core routing algorithms and GraphHopper extensions, `ors-benchmark` provides Gatling-based load testing and coordinate generation tools, and `ors-test-scenarios` runs containerized integration tests. Advanced features include fast isochrones via graph partitioning (InertialFlow, contraction hierarchies), RPHAST for many-to-many matrices, and core routing with landmarks (ALT). Graph lifecycle management supports remote repository download (HTTP, Minio, filesystem) and hot-reload. While primarily an application, the repository incorporates data research elements: OSM data pipelines for tag filtering and elevation processing, statistical population queries for isochrones, and environmental routing indices (noise, shadow, green) sourced from CSV files. The codebase demonstrates strong engineering practices – modular design, extensive unit/integration tests, property-based testing, and a plugin system for extensible storages – though heavy customization of GraphHopper internals introduces maintenance risks and a moderate technical drift from upstream.
The LLM identified 5 files worth highlighting for reuse:
Provides static methods for Haversine distance calculation between coordinates, random point generation within a given extent or radius, and snapping coordinates to a road network. These operations are isolated from ORS internals and follow a clean utility class pattern, making them directly reusable in any geospatial project needing random point generation or distance computation.
A fast, thread-safe double formatting utility that avoids the overhead of DecimalFormat or String.format. It formats doubles with a configurable number of decimal places using direct math operations, demonstrating non-obvious performance optimization. This is a small, standalone class that can be extracted into any Java project requiring high-performance double-to-string conversion.
Implements the Google Polyline encoding algorithm for representing lists of coordinates as compact strings. The class provides both encoding and decoding with a clean, stateless API and proper error handling. This is a classic reusable component, applicable to any project that exchanges geospatial paths in the polyline format.
Abstract base class for graph storage builders during OSM import. It provides lifecycle hooks (onProcessWay, processEdge, finish) and manages a shared CsvReader for external data files. This template method pattern is well-isolated from the rest of ORS and can be reused in any GraphHopper-based project needing custom per-edge data injection from CSV sources.
Manages local graph files with versioned directories, backup rotation (keeping N backups), and safe extraction of .ghz archives with zip-slip protection. It encapsulates file system operations for graph lifecycle (list, copy, delete, swap active) and can be extracted as a generic versioned file manager for any application that requires atomic updates and backup retention.