expo-osm-sdk
Version:
OpenStreetMap component for React Native with Expo
63 lines • 2.08 kB
TypeScript
import { Coordinate, Route } from '../types';
/**
* OSRM Profile types for different routing modes
* Note: 'transit' is not a native OSRM profile but is handled separately
*/
export type OSRMProfile = 'driving' | 'walking' | 'cycling' | 'transit';
/**
* Native OSRM profiles (excluding transit)
*/
export type NativeOSRMProfile = 'driving' | 'walking' | 'cycling';
/**
* OSRM Route options
*/
export interface OSRMRouteOptions {
profile?: OSRMProfile;
alternatives?: boolean;
steps?: boolean;
geometries?: 'polyline' | 'polyline6' | 'geojson';
overview?: 'full' | 'simplified' | 'false';
continue_straight?: boolean;
}
/**
* Calculate route between multiple waypoints
*
* @param waypoints - Array of coordinates (minimum 2 points)
* @param options - Routing options
* @returns Promise<Route[]>
*/
export declare const calculateRoute: (waypoints: Coordinate[], options?: OSRMRouteOptions) => Promise<Route[]>;
/**
* Calculate simple point-to-point route
*
* @param from - Start coordinate
* @param to - End coordinate
* @param profile - Routing profile
* @returns Promise<Route>
*/
export declare const calculateSimpleRoute: (from: Coordinate, to: Coordinate, profile?: OSRMProfile) => Promise<Route>;
/**
* Get route duration estimate (without full route calculation)
*
* @param from - Start coordinate
* @param to - End coordinate
* @param profile - Routing profile
* @returns Promise<{distance: number, duration: number}>
*/
export declare const getRouteEstimate: (from: Coordinate, to: Coordinate, profile?: OSRMProfile) => Promise<{
distance: number;
duration: number;
}>;
/**
* Format duration in human-readable format
*/
export declare const formatDuration: (seconds: number) => string;
/**
* Format distance in human-readable format
*/
export declare const formatDistance: (meters: number) => string;
/**
* Calculate straight-line distance between two coordinates (fallback)
*/
export declare const calculateStraightLineDistance: (from: Coordinate, to: Coordinate) => number;
//# sourceMappingURL=osrm.d.ts.map