Skip to main content

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
  • Wheelchair 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 routes
  • CAR: Vehicle routes
  • TRANSIT: Public transportation routes
  • And more...

Route Options

  • pmr: Avoid stairs and escalators (Person with Reduced Mobility)
  • departureDate: Specify departure time for transit routes

wemap-sdk-js


routing

Classes

Other

Routing

Routing package - Route calculation and navigation functionality

Provides routing capabilities including route calculation, itinerary management, and navigation utilities for working with routes and current position.

Interfaces

Type Aliases