Street Penalties for Routing API

From “Avoid” to “How Much to Avoid”

The Routing API has always let you avoid things: highways, toll roads, ferries, rail shuttles. Useful, but blunt. “Avoid” is a switch — it is on or off, and behind the scenes it maps to one fixed penalty. You cannot say how strongly to avoid a ferry, and you cannot ask the router to prefer a road type. For a lot of operations, that is not enough control, and the route that comes back is not quite the route they expected.

What’s new

Penalties give you the dial that the avoid switch never had. You can assign a graded cost to road categories, ferries, rail shuttles, toll roads, and delivery-only and residents-only roads, on a scale from –99 to 2501. Minus ninety-nine is an absolute preference for that road type; zero is neutral; 2501 blocks it. Everything in between trades the road type off against the rest of the route — set a small ferry penalty and the route still boards; raise it past a threshold and the route goes around. A separate option lets a vehicle pass gates reserved for delivery vehicles, such as the entrance to factory premises.

Where it lives

Penalties sit in the route options in the body of the POST operation, alongside the speeds option. Every routing profile ships sensible default penalties, which you can read through the Data API and adjust from there — a graded value where before there was only a switch, with no extra business logic to reason about.

Why it matters now

The default cost-optimal route is not always the route an operation wants. Penalties give planners a precise way to shape routes to real preferences — treat a ferry as a last resort, steer off certain road categories, or favour others — turning blunt on/off avoidance into graded control. It is a long-requested capability, and it is now on production.

Learn more

Try it and contact us

By Stephan Ruppert

Principal Product Manager for Developer Components at PTV Logistics.