Compute an isochrone with Thinwrap (TypeScript)

Compute a travel-time / travel-distance polygon (isochrone) via the Thinwrap unified Isochrone facade in TypeScript — same call shape for Mapbox, HERE, ESRI, and TomTom.

1. Install

npm install @thinwrap/location

2. Send the call

import { Isochrone } from '@thinwrap/location';

const isochrone = new Isochrone('mapbox', {
  accessToken: process.env.MAPBOX_TOKEN!,
});

const result = await isochrone.isochrone({
  center: { lat: 37.7749, lng: -122.4194 },
  type: 'time', // 'time' (seconds) or 'distance' (meters)
  values: [300, 600, 900], // 5, 10, 15 minutes; capped at 4 per request
  travelMode: 'driving', // base shape narrows to 'driving' | 'walking'
});

// result.isochrones[] — one polygon per requested value, sorted ascending.
for (const iso of result.isochrones) {
  console.log(iso.value, 'second band, polygon vertices:', iso.polygon.length);
}

Same code works for all supported providers — just change the provider ID.