these days I've been asked how a routing could be parametrized to avoid the region of Kaliningrad. Here's my feedback:
I see at least two approaches to achieve this goal with xServer2. BOth are based on GeographicRestrictions
- Use prohibitedCountries to prevent the route from using segments in the russian country as a whole. This is based on so-called integration units which are "countries (Europe)" or "federal states (USA)".
- Evaluate the prohibitedSegmentsByIntersectingPolylines if the approach above doesn't match your settings to whatever reason. Maybe a bit more complicated because you would have to gather the polyline of the enclave first. You may look into osm-boundaries.com for this. But be aware that the maximum nomber of polygon points
PS: if you look closely you see that the initial blue route is longer and slowlier than the other alternatives and the question may rise "why did you return blue at all?" - this is because of the network malus values. The blue line uses a bigger distance of major roads.