Skip to content

Select CH profiles by name ? #1708

Closed
Closed

Description

@easbar

Continuing some of the discussion that started in #1705.

But can't this be simplified enormously if we just give every profile that a GraphHopper instance supports (not only every CHProfile; every profile) a name in the configuration file?

But isn't this the case already ? For example we have graph.flag_encoder=foot,car|turn_costs=true. Not thinking about CH for a moment this means we can do routing for foot and car and for car we also get a turn cost extension (i.e. we can route with turn restrictions from OSM). Also we can use the different query parameters, like heading, alternative etc. And you mean all the different combinations should be listed upfront ?

For CH we have to list this upfront because the preparation needs to be done prior to the routing. One thing that def. can be improved is how these preparations are specified, #493. The other question is then how the request parameters are mapped to the preparations afterwards.

Say somebody sets up a GH server for a new app that has two CH profiles for two different user groups: one group moves around a city using bicycles preferring roads with bicycle lanes and another uses trucks and can only drive to certain parts of the city. I imagine the best to do would be to have a nice way to specify all the parameters that go into the CH preparation like the road weights, the blocked areas etc. (making this easy to configure is #493), then give this profile some (arbitrary) name, and afterwards select the profile using this name (maybe the app that is used knows the user group via login). So here it would be useful to give a profile a name/id and use this on the request.

Or thinking about the GH directions API: It is running for some fixed set of profiles. It would be easy to document what these profiles are and give them an id/name and then choose the profile by name on the request. This seems a lot more intuitive than having to specify the weighting, encoder, u-turn-costs and all this just so the request 'matches' one of the profiles (and in case it does not getting an error / or a slow algorithm if falling back to non-CH). Or even better add an endpoint to the server that lists all the available profiles.

Even for flexible CH it would be similar I think. Say there is the possibility to build a CH preparation 'on the fly'/while the server is running (which I very much hope it will be at some point). This will certainly take a lot of memory and the preparation needs to be stored or kept in memory etc. To use it later it has to have some name and to me its also the most obvious way to use nothing but this name to refer to this preparation.

Right now I cannot come up with a case where it would not be feasible to 1) lookup the documentation/special endpoint etc. of whatever GH server is running, 2) check what profiles are supported and find the name of the one that should be used, 3) run a route request with the name of the desired profile attached ?

Activity

  1. easbar commented on Jan 1, 2020

    @easbar
    MemberAuthor

    What kind of request parameter should be used to select the profile: From #1838:

    the configuration (with which the CH preparation is done) could be picked up via the vehicle and/or weighting parameters (?)

    • vehicle
    • weighting
    • a new one, e.g. ch.profile ?
  2. karussell commented on Jan 1, 2020

    @karussell
    Member

    Have now a use case that uses the configurable Weighting for CH preparation and without other bigger modifications and I better understand the requirements:

    40c2bbe#diff-34c31269f729871c0059410df746e62dR46

    It was required to directly use the weighting=flex|truck as the CH profiles and the "base FlagEncoder" for vehicle parameter, which is a bit ugly. It would be cleaner if the vehicle parameter is not required. And using the weighting parameter only is not easily possible as just weighting=fastest is not sufficient and we would need weighting=fastest|car in general, which could break backward compatibility.

    If we need to introduce a new parameter I would introduce a profile parameter, instead of a CH specific ch.profile parameter. As we would otherwise need a xy.profile parameter for all pre-calculated algorithms (like lm.profile)?

  3. karussell commented on Apr 17, 2020

    @karussell
    Member

    Fixed via #1934

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions