Skip to content

JSON output should contain snapped points for start, destination and via points #727

Closed

Description

@karussell

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?

Activity

  1. added this to the 0.7 milestone on May 26, 2016
  2. oblonski commented on May 27, 2016

    @oblonski
    Member

    I like snapped_points or network_points to differentiate them from input coordinates, i.e. point.

  3. karussell commented on May 27, 2016

    @karussell
    MemberAuthor

    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

  4. oblonski commented on May 27, 2016

    @oblonski
    Member

    snapped_points or waypoints are fine. snapped_points sounds slightly clearer for this purpose to me.

  5. karussell commented on May 27, 2016

    @karussell
    MemberAuthor

    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?

  6. karussell commented on May 27, 2016

    @karussell
    MemberAuthor

    Merged into master.

  7. boldtrn commented on May 28, 2016

    @boldtrn
    Member

    @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.

  8. karussell commented on May 28, 2016

    @karussell
    MemberAuthor

    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.

  9. boldtrn commented on May 28, 2016

    @boldtrn
    Member

    @karussell Yes sorry, you are right. I was probably too fast with that assumption.

  10. 7 remaining items

  11. karussell commented on May 31, 2016

    @karussell
    MemberAuthor

    Should we return an encoded string for snapped_waypoints if encoded_points=true?

  12. boldtrn commented on May 31, 2016

    @boldtrn
    Member

    @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.

  13. karussell commented on May 31, 2016

    @karussell
    MemberAuthor

    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.

  14. boldtrn commented on May 31, 2016

    @boldtrn
    Member

    Gzipping should be done due to the GzipHandler

    If I request a route from GraphHopper Maps the response is not gziped. Interestingly Kurviger gzips the result. But that can have other reasons.

  15. karussell commented on May 31, 2016

    @karussell
    MemberAuthor

    Thanks - will have a look & opened this here instead: graphhopper/directions-api#28

  16. karussell commented on Jun 7, 2016

    @karussell
    MemberAuthor

    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

  17. boldtrn commented on Jun 13, 2016

    @boldtrn
    Member

    We should also encode the snapped waypoint in JS.

    I think adding this to the GHRequest.js should be enough:

    var tmpSnappedPoints = graphhopperTools.decodePath(path.snapped_waypoints, that.hasElevation());
    path.snapped_waypoints = tmpSnappedPoints;
    
  18. karussell commented on Jun 13, 2016

    @karussell
    MemberAuthor

    👍 Thanks! Never thought that such a simple feature results in so many considerations one has to make ;)

  19. added a commit that references this issue on Jun 13, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions