如何在HERE API中获取排除轮渡里程的路线距离
How to Exclude Ferry Mileage in HERE Route Calculation API
I get exactly what you're dealing with right now—your current HERE API request is factoring in ferry mileage into the total distance (giving you 128.81km), but you need the actual land-only route length which is under 100km. Fixing this is straightforward: you just need to add a parameter to tell the API to completely avoid ferries when planning the route.
Modified API Request
Here’s your updated request with the ferry-avoidance parameter included:
https://tce.cit.api.here.com/2/calculateroute.json?mode=fastest;truck;traffic:disabled&truckType=tractorTruck&maneuverAttributes=none&combineChange=true&routeAttributes=none,wp,sm,sh,no&linkAttributes=none&legAttributes=none&detail=1&alternatives=2&rollup=total,country&jsonattributes=41&waypoint0=geo!stopOver!51.006511,2.321095&waypoint1=geo!stopOver!51.137062,0.911495&avoid=ferry
Key Change Breakdown
- The
&avoid=ferryparameter is the fix here: it tells the routing engine to exclude all ferry routes from its path calculations. This ensures the returned distance only covers roads accessible to your tractor truck, with no ferry segments included.
Extra Tips
- If you ever need to avoid other route types (like tunnels, toll roads, or unpaved roads), you can expand this parameter with comma-separated values, e.g.,
avoid=ferry,tollroad,tunnel. - Your existing truck-specific parameters (
mode=fastest;truck,truckType=tractorTruck) still work as intended, so the route will remain optimized for your vehicle type.
Once you use this modified request, the total distance returned should align with the land-only route length you’re expecting.
内容的提问来源于stack exchange,提问作者cslehel
相关产品推荐
相关产品推荐

