OrsClient

interface OrsClient

Abstraction over the OpenRouteService HTTP API.

Implementations map these suspending functions to the respective REST endpoints as documented in the OpenRouteService API reference.

Functions

Link copied to clipboard
abstract suspend fun export(profile: Profile, exportRequest: ExportRequest): ExportResponse

Calls the export endpoint returning plain JSON.

Link copied to clipboard
abstract suspend fun exportJson(profile: Profile, exportRequest: ExportRequest): ExportResponse

Same as export but explicitly requesting JSON output.

Link copied to clipboard
abstract suspend fun exportTopoJson(profile: Profile, exportRequest: ExportRequest): TopoJsonExportResponse

Requests TopoJSON output from the export endpoint.

Link copied to clipboard
abstract suspend fun geocodeAutocomplete(apiKey: String, text: String, focusLon: Double? = null, focusLat: Double? = null, rectMinLon: Double? = null, rectMinLat: Double? = null, rectMaxLon: Double? = null, rectMaxLat: Double? = null, circleLon: Double? = null, circleLat: Double? = null, circleRadius: Double? = null, country: String? = null, sources: List<String>? = null, layers: List<String>? = null, size: Int? = null): GeocodeSearchResponse

Autocomplete endpoint returning suggestions for a partial query.

Link copied to clipboard
abstract suspend fun geocodeReverse(apiKey: String, lon: Double, lat: Double, radiusKm: Double? = null, size: Int? = null, layers: List<String>? = null, sources: List<String>? = null, boundaryCountry: String? = null): GeocodeSearchResponse

Reverse geocoding for a single coordinate.

Link copied to clipboard
abstract suspend fun geocodeSearch(text: String, apiKey: String, focusLon: Double? = null, focusLat: Double? = null, rectMinLon: Double? = null, rectMinLat: Double? = null, rectMaxLon: Double? = null, rectMaxLat: Double? = null, circleLon: Double? = null, circleLat: Double? = null, circleRadiusMeters: Double? = null, boundaryGid: String? = null, boundaryCountry: String? = null, sourcesCsv: String? = null, layersCsv: String? = null, size: Int? = 10): GeocodeSearchResponse

Forward geocoding search endpoint.

Link copied to clipboard
abstract suspend fun geocodeStructured(apiKey: String, address: String? = null, neighbourhood: String? = null, borough: String? = null, locality: String? = null, county: String? = null, region: String? = null, country: String? = null, postalcode: String? = null, focusLon: Double? = null, focusLat: Double? = null, rectMinLon: Double? = null, rectMinLat: Double? = null, rectMaxLon: Double? = null, rectMaxLat: Double? = null, circleLon: Double? = null, circleLat: Double? = null, circleRadiusMeters: Double? = null, boundaryCountry: String? = null, layers: List<String>? = null, sources: List<String>? = null, size: Int? = null): GeocodeSearchResponse

Structured forward geocoding using discrete address fields.

Link copied to clipboard
abstract suspend fun getElevationLine(elevationLineRequest: ElevationLineRequest): ElevationLineResponse

Calls the elevation/line endpoint.

Link copied to clipboard
abstract suspend fun getElevationPoint(elevationPointRequest: ElevationPointRequest): ElevationPointResponse

Calls the elevation/point endpoint.

Link copied to clipboard
abstract suspend fun getIsochrones(profile: Profile, isochronesRequest: IsochronesRequest): IsochronesResponse

Accesses the isochrones endpoint.

Link copied to clipboard
abstract suspend fun getMatrix(profile: Profile, matrixRequest: MatrixRequest): MatrixResponse

Calls the matrix endpoint and returns distance/duration matrices.

Link copied to clipboard
abstract suspend fun getOptimization(optimizationRequest: OptimizationRequest): OptimizationResponse

Delegates to the VROOM based optimization service.

Link copied to clipboard
abstract suspend fun getPois(poisRequest: PoisRequest): PoisGeoJsonResponse

Queries points of interest and returns a GeoJSON feature collection.

Link copied to clipboard
abstract suspend fun getRoute(profile: Profile, routeRequest: RouteRequest): RouteResponse

Requests a route using the Directions endpoint. GET /v2/directions/{profile}

Link copied to clipboard
abstract suspend fun getRouteGeoJson(profile: Profile, routeRequest: RouteRequest): GeoJsonRouteResponse

Retrieves the route as GeoJSON feature collection.

Link copied to clipboard
abstract suspend fun getRouteGpx(profile: Profile, routeRequest: RouteRequest): String

Retrieves the route as GPX.

Link copied to clipboard
abstract suspend fun getSnap(profile: Profile, snapRequest: SnapRequest): SnapResponse

Snaps coordinates to the road network.

Link copied to clipboard
abstract suspend fun getSnapGeoJson(profile: Profile, snapRequest: SnapRequest): SnapGeoJsonResponse

Snaps coordinates and returns a GeoJSON response.

Link copied to clipboard
abstract suspend fun getSnapJson(profile: Profile, snapRequest: SnapRequest): SnapResponse

Snaps coordinates and returns the JSON variant of the response.