Calculate an Isochrone
Problem: I need the polygon of everywhere reachable from a point within 20 minutes.Prerequisites
- A HERE API key with Isoline Routing entitlement
export HERE_API_KEY="..."- A Flexible Polyline decoder (HERE’s reference implementations)
Isoline Routing is its own API, at
isoline.router.hereapi.com, not an endpoint on the Routing API. This changed in v8.If you are reading a tutorial using isoline.route.ls.hereapi.com/routing/7.2/calculateisoline.json, you are reading v7. Migration notes: start → origin; range + rangeType → range[type] + range[values]; resolution → shape[maxResolution] (and it is now 3× as precise); XML is gone; truck parameters are deprecated in favour of vehicle.The code
Response walkthrough
range[values] units differ by range[type]:
polygons is an array. More than one means the reachable area is disconnected — separated by water, a ferry, or a one-way system. A connections list identifies which polygons connect and how. Do not assume one ring.
Geometry is Flexible Polyline. Not Google’s encoded polyline. Use HERE’s decoders.
Failure returns notices:
Common mistakes
Calling this at request time. Materialize it. Looping the endpoint for each band.range[values]=600,1200,1800 returns three polygons in one call.
Assuming one polygon per isoline. Disconnected components exist.
Decoding with a Google polyline library. Different algorithm.
Requesting distance when you meant time. Both valid. One answers your business question.
Ignoring departureTime. A 3am polygon is not your delivery zone at 6pm.
Using car mode for a truck service area. Trucks cannot use every road in the polygon.
shape[maxPoints] below 100. HERE enforces a minimum of 30 and recommends above 100. Quality degrades below that.
Assigning customers to stores by polygon membership. Two stores’ 20-minute polygons overlap. Assign by travel time from a matrix.
Production considerations
Compute once, store in PostGIS, query withST_Contains. A 400-store network with three bands is 1,200 calls per quarter. The cost is bounded by store count — a number you already know.
Simplify before storage. The polygon was an approximation with a resolution parameter to begin with. Smaller geometry, faster containment queries, no accuracy you were entitled to.
Store multiple bands as separate rows. Delivery pricing by band becomes a lookup.
Recompute on events, not on a timer. New location, closed location, changed service promise, significant map release.
Version them. When a customer disputes “you delivered here last month,” you need to know which polygon was live.
From-origin ≠ to-destination. “Which customers can we reach in 30 minutes” and “which customers can reach us” are different polygons where one-way streets exist. Ask the question you mean.
Related
Catchment Area
Range types, resolution, and why the polygon is an approximation.
Delivery Zones
The materialization pattern this entire example exists to enable.
Site Selection
Trade areas, cannibalization, and the overlap join.
Cost Optimization Patterns
Pattern 3: precompute and materialize.
HERE documentation
- Isoline Routing v8 get started
- Isoline response structure
- Isoline v7 → v8 migration guide
- Flexible Polyline decoders
Need production HERE API keys or implementation support? Placematic is an official HERE Technologies reseller and implementation partner. Talk to us.