Isochrone
Compute the geographic area reachable from a point in N minutes or N kilometers. Returned as GeoJSON Polygon.
The Isochrone endpoint computes the reachable area from an origin within a given time (in minutes) or distance (in kilometers). The result is a GeoJSON polygon ready to render on a map.
Endpoint
POST
https://api.tmaps.tn/routing/isochrone?api_key=YOUR_API_KEY Parameters
JSON body
| Param | Type | Requis | Défaut | Description |
|---|---|---|---|---|
origin | object | oui | — | Starting point { lat, lng }. |
contours | array | oui | — | List of contours to compute. Each contour is { time: minutes } or { distance: km }. Multiple contours can be requested in a single call. |
profile | string | — | driving | Transport profile: driving, walking, cycling, truck. |
colors | array | — | — | HTML color (hex) per contour to ease rendering (e.g. ['#22c55e', '#f59e0b', '#ef4444']). |
Limits
- Max time: 60 minutes per contour.
- Max distance: 50 km per contour.
- Max contours: 4 per request (for stacked isochrones).
Example — 15-min driving catchment area
curl -X POST "https://api.tmaps.tn/routing/isochrone?api_key=YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"origin": { "lat": 36.8002, "lng": 10.1815 },
"contours": [{ "time": 15 }],
"profile": "driving"
}'Example — stacked isochrones (5 / 10 / 15 min)
const res = await fetch(
'https://api.tmaps.tn/routing/isochrone?api_key=YOUR_API_KEY',
{
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
origin: { lat: 36.8002, lng: 10.1815 },
contours: [
{ time: 5 },
{ time: 10 },
{ time: 15 },
],
profile: 'driving',
colors: ['#22c55e', '#f59e0b', '#ef4444'],
}),
}
);
const geojson = await res.json();
// → 3 features in the FeatureCollectionResponse
The response is a GeoJSON FeatureCollection with one feature per requested contour, in the same order as the request.
200 Area reachable in 15 minutes by car from Tunis center
{
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"properties": {
"contour": 15,
"metric": "time",
"color": "#22c55e"
},
"geometry": {
"type": "Polygon",
"coordinates": [[
[10.0801, 36.8412],
[10.1240, 36.8650],
[10.2308, 36.8580],
[10.2620, 36.8011],
[10.2210, 36.7530],
[10.1100, 36.7480],
[10.0801, 36.8412]
]]
}
}
]
} Returned fields
Feature properties
| Param | Type | Requis | Défaut | Description |
|---|---|---|---|---|
contour | number | — | — | Contour value: number of minutes or kilometers. |
metric | string | — | — | time or distance depending on the request. |
color | string | — | — | Color associated with the contour, if provided in input. Convenient to style the map layer directly. |
Render order
When requesting multiple stacked contours, draw the largest (15 min) at the back and the smallest (5 min) on top to get nice concentric rings.
Use cases
- Geomarketing & retail: catchment areas to open a new store.
- Real estate: show “all schools within 10 minutes’ walk of this property”.
- Logistics: areas serviceable by a depot in under 30 minutes.
- Emergency services: 5-min coverage of a fire station / hospital.
Errors
| Status | Cause |
|---|---|
400 | Missing origin, time > 60 or distance > 50 |
401 | Missing or revoked api_key |
403 | Domain not authorized |
404 | Origin outside coverage |
See Error codes for the full list.