Documentation menu
Example
Truck route with dimensions and ADR
A 44 tonne artic, 4.0 m high, carrying dangerous goods under ADR tunnel restriction code C/E. The dimensions and the tunnel code go into costing, so the route comes back already refusing what the vehicle cannot legally take.
ts
import { RouteLayer } from "@mapmap/maps";
const routes = new RouteLayer(map);
const route = await routes.route(
{ lng: 1.3134, lat: 51.1279 }, // Dover
{ lng: -1.8904, lat: 52.4862 }, // Birmingham
{
profile: "truck",
truck: {
heightM: 4.0,
widthM: 2.55,
lengthM: 16.5,
weightT: 44,
hazmat: true,
tunnelCode: "C/E",
},
},
);
console.log(route.distanceM, route.durationS); // metres, seconds