如何为HERE Maps等时线请求指定出发时间?
Hey there! Great question—let me break this down for you clearly:
Yes, the HERE time-based isoline API does support specifying a departure time—you just need to use the right parameter, which is slightly different from the standard route-placing endpoint you referenced.
Here's what you need to know:
- For the basic "route from A to B" endpoint, you use the
departureparameter. For isoline routing, the equivalent parameter isdepartureTime. - This parameter accepts two types of values:
- Absolute time: Use an ISO 8601 formatted string, like
2024-05-20T08:30:00(for 8:30 AM on May 20th, 2024) - Relative time: Use values like
+30m(30 minutes from now),+2h(2 hours from now), or the defaultnow(current time)
- Absolute time: Use an ISO 8601 formatted string, like
- Example of adding it to your API call:
https://isoline.route.ls.hereapi.com/routing/7.2/calculateisoline.json?apiKey=YOUR_KEY&mode=fastest;car;traffic:enabled&start=geo!52.5159,13.3777&range=600&rangeType=time&departureTime=2024-05-20T08:30:00
The reason you were seeing variable results before is that the default departureTime=now uses real-time traffic data, which changes throughout the day. By setting a fixed departure time, you'll get consistent isoline results based on the traffic conditions predicted for that specific time.
If you ever need to generate isolines based on historical traffic patterns (instead of real-time or predicted), you can pair departureTime with the traffic:historical mode parameter—but departureTime itself is the key to locking in your desired start time.
内容的提问来源于stack exchange,提问作者Negapizza

