You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
JSON output should contain snapped points for start, destination and via points #727
Currently the snapped points are only accessible via the instructions special "via point" sign which makes using the API a bit ugly. A simple array containing all snapped points would be nice e.g. points_snapped or snapped_points or just points?
Ok, also points is already used for the output geometry. Another option would be input_points or waypoints? waypoints would be align to the wpt of the GPX here
The term snapped makes it more clear but the underscore makes it very similar to points (which should be renamed to geometry -> see #437). But maybe for now snapped_waypoints could work?
@karussell Great news, thanks! Just a minor comment: Why do we return each snapped point as an array instead of an object? In my opinion it would be better if each snapped point would be returned as Json Object with lat, lng, height props.
We already return locations as arrays in points if encoded_points=false. Also GeoJSON is similar and it saves a few characters, especially if many entries. In a later version (see #437) we can make this more consistent or use GeoJSON.
@karussell It would be consistent and would save traffic. On the other hand it will be harder to debug and usually there are not that many snapped points. The size of a snapped waypoint would be about 25 bytes. Even if we have 100 snapped waypoints, that would be about 2kb. A response of a route from Berlin to Munich is 28.8 kb (car) and 158 kb (bicycle). So I guess for most use cases encoding and decoding would be an overhead. But for some, it will will make sense.
BTW: I just saw that we don't GZIP the response. But that is probably a different discussion - and probably there is a discussion about that somewhere, but I couldn't find it.
Ok, I'll keep it for now. The encoding makes everything a bit harder and also one cannot easily write a swagger spec for this :/
Have to contradict myself: will make this dependent on the calc_points parameter to make it more consistent. I know we do not have many things consistent (see #437) but we should still strive for less inconsistency
Activity
oblonski commentedon May 27, 2016
I like
snapped_pointsornetwork_pointsto differentiate them from input coordinates, i.e.point.karussell commentedon May 27, 2016
Ok, also
pointsis already used for the output geometry. Another option would beinput_pointsorwaypoints?waypointswould be align to thewptof the GPX hereoblonski commentedon May 27, 2016
snapped_pointsorwaypointsare fine.snapped_pointssounds slightly clearer for this purpose to me.karussell commentedon May 27, 2016
The term
snappedmakes it more clear but the underscore makes it very similar topoints(which should be renamed togeometry-> see #437). But maybe for nowsnapped_waypointscould work?include snapped waypoints in JSON. #727
adapt java client and docs for #727
fixed java client for #727
karussell commentedon May 27, 2016
Merged into master.
boldtrn commentedon May 28, 2016
@karussell Great news, thanks! Just a minor comment: Why do we return each snapped point as an array instead of an object? In my opinion it would be better if each snapped point would be returned as Json Object with lat, lng, height props.
karussell commentedon May 28, 2016
We already return locations as arrays in
pointsifencoded_points=false. Also GeoJSON is similar and it saves a few characters, especially if many entries. In a later version (see #437) we can make this more consistent or use GeoJSON.boldtrn commentedon May 28, 2016
@karussell Yes sorry, you are right. I was probably too fast with that assumption.
7 remaining items
fix bug in GraphHopperWeb #727
return to old behaviour for getPoints (otherwise we break existing co…
karussell commentedon May 31, 2016
Should we return an encoded string for
snapped_waypointsifencoded_points=true?boldtrn commentedon May 31, 2016
@karussell It would be consistent and would save traffic. On the other hand it will be harder to debug and usually there are not that many snapped points. The size of a snapped waypoint would be about 25 bytes. Even if we have 100 snapped waypoints, that would be about 2kb. A response of a route from Berlin to Munich is 28.8 kb (car) and 158 kb (bicycle). So I guess for most use cases encoding and decoding would be an overhead. But for some, it will will make sense.
BTW: I just saw that we don't GZIP the response. But that is probably a different discussion - and probably there is a discussion about that somewhere, but I couldn't find it.
karussell commentedon May 31, 2016
Ok, I'll keep it for now. The encoding makes everything a bit harder and also one cannot easily write a swagger spec for this :/
BTW: Gzipping should be done due to the
GzipHandler. There is no longer a gzip servlet.boldtrn commentedon May 31, 2016
If I request a route from GraphHopper Maps the response is not gziped. Interestingly Kurviger gzips the result. But that can have other reasons.
karussell commentedon May 31, 2016
Thanks - will have a look & opened this here instead: graphhopper/directions-api#28
karussell commentedon Jun 7, 2016
Have to contradict myself: will make this dependent on the
calc_pointsparameter to make it more consistent. I know we do not have many things consistent (see #437) but we should still strive for less inconsistencyfix bug in web client related to snapped_waypoints #727
boldtrn commentedon Jun 13, 2016
We should also encode the snapped waypoint in JS.
I think adding this to the GHRequest.js should be enough:
karussell commentedon Jun 13, 2016
👍 Thanks! Never thought that such a simple feature results in so many considerations one has to make ;)
improved JS response for #727