Repository navigation
Snap preventions default - #3075
Conversation
| url += "&" + Parameters.Routing.SNAP_PREVENTION + "=" + encodeURL(snapPrevention); | ||
| if (ghRequest.hasSnapPreventions()) { | ||
| if (ghRequest.getSnapPreventions().isEmpty()) | ||
| url += "&" + Parameters.Routing.SNAP_PREVENTION + "="; // send empty value to indicate explicit empty list |
There was a problem hiding this comment.
For GET requests sending an empty list to overwrite the server-side default is a bit special using an empty value like &snap_prevention= in the URL.
| private List<String> pointHints = new ArrayList<>(); | ||
| private List<String> curbsides = new ArrayList<>(); | ||
| private List<String> snapPreventions = new ArrayList<>(); | ||
| private List<String> snapPreventions; |
There was a problem hiding this comment.
default must be null to differentiate between empty and not-specified snap_preventions list.
|
|
||
| if (uriInfo.getQueryParameters().containsKey(SNAP_PREVENTION)) { | ||
| if (snapPreventions.size() == 1 && snapPreventions.contains("")) | ||
| request.setSnapPreventions(List.of()); // e.g. "&snap_prevention=&" to force empty list |
There was a problem hiding this comment.
For GET requests sending an empty list to overwrite the server-side default is a bit special using an empty value like &snap_prevention= in the URL.
|
What if i want to do it in the local version of the open source routing engine? I'm not being able to alter the snap preventions, it's always going for the default even if i do List snappreventions = new ArrayList<>(); and then GHRequest req = new GHRequest(start.valid_lat, start.valid_lon, end.valid_lat, end.valid_lon) |
For route planning the current empty default for "snap_preventions" is suboptimal. This PR makes it possible to provide a default snap_preventions list on the server-side which can be overwritten on the client-side.