@wemap/routing
v14.0.0
Published
The routing package provides route calculation and navigation capabilities.
Readme
Routing Package
The routing package provides route calculation and navigation capabilities.
Features
- Route Calculation: Calculate routes between two points using various travel modes
- Multiple Itineraries: Get multiple route options sorted by preference
- Travel Modes: Support for walking, driving, transit, and more
- PMR Support: Options to avoid stairs and escalators for accessibility
Getting Started
import { Router } from '@wemap/routing';
import { core } from '@wemap/core';
// Initialize core SDK first
await core.init({ emmid: '...', token: '...' });
// Create router and calculate route
const router = new Router();
const itineraries = await router.directions(
{ lat: 48.8566, lon: 2.3522 },
{ lat: 48.8606, lon: 2.3376 },
'WALK',
{ pmr: true }
);
// Use the first (usually best) itinerary
const bestRoute = itineraries[0];
console.log(`Distance: ${bestRoute.distance}m`);
console.log(`Duration: ${bestRoute.duration}s`);Travel Modes
WALK: Pedestrian routesCAR: Vehicle routesTRANSIT: Public transportation routes- And more...
Route Options
pmr: Avoid stairs and escalators (Person with Reduced Mobility)departureDate: Specify departure time for transit routes
