Skip to content

Remove "FlagEncoder" concept #2463

Closed
Closed

Activity

  1. otbutz commented on Nov 17, 2021

    @otbutz
    Contributor

    IMHO #2460

  2. easbar commented on Nov 17, 2021

    @easbar
    MemberAuthor

    IMHO #2460

    Yes, everything related to access and access flags is related. Just not sure if this is required to remove the FlagEncoders (or vice versa).

  3. otbutz commented on Nov 18, 2021

    @otbutz
    Contributor

    Removing FlagEncoders requires #2460 to be solved but we can implement it without removing FlagEncoders. At least that is my understanding of it.

    The benefit is that users can perform proper truck routing without touching the code :)

  4. easbar commented on Jun 13, 2022

    @easbar
    MemberAuthor

    I think we are getting there :) What we probably should do next is:

    • allow storing the maximum, actually used values for encoded values, so we can replace encoder.getMaxSpeed() with speedEnc.getMaxValue() or similar. This would be an improvement by itself, because we no longer have to keep the max value synchronized between the vehicle tag parsers and the flag encoders. -> Use actual speed maximum rather than flagEncoder#getMaxSpeed() for weighting.getMinWeight() #2614, Rename getMin/MaxInt -> getMin/MaxStorableInt, getMaxSetValueOrMax -> getMaxOrMaxStorable #2616, Remove FlagEncoder#getMaxSpeed() #2619
    • replace the FlagEncoder parameters from the weighting constructors with references to the encoded values they need. For example instead of receiving a FlagEncoder and calling encoder.getAverageSpeedEnc(), the FastestWeighting should receive the speed encoded value (and encoded values it needs besides this of course). -> Remove FlagEncoder #2611 and 15426ef
    • For FastestWeighting we also need to replace encoder.isMotorVehicle()/HGV() with some boolean constructor parameters representing these values (or just a PMap). Maybe we should take these parameters from the weighting string, i.e. something like weighting: fastest|is_motor_vehicle=true. Or we skip this intermediate step and replace FastestWeighting (and the others) with CustomWeighting directly. -> see Remove FlagEncoder #2611, this is done in DefaultWeightingFactory now.
    • One problem is that we have literally thousands of usages of GHUtility#setSpeed(..., encoder, ...) that we will have to replace with something similar that uses the speed/access encoded values directly. I did some unfinished work in this direction some time ago here: 9715c81. -> Remove FlagEncoder #2611
  5. easbar commented on Jul 4, 2022

    @easbar
    MemberAuthor

    Not all the issues we mentioned here are fixed, but flag encoders are almost gone since #2611 :)

    The only place they remain now is in config.yml/Graphhopper.java. For example graph.flag_encoders=car,bike does two things now:

    1. It creates VehicleEncodedValues for car and bike, which just means that the car_access, car_average_speed, car_turn_cost, bike_access, bike_average_speed and bike_priority encoded values are added to the graph / encoding manager.

    2. It enables the Car/BikeTagParsers, which require above encoded values.

    We also have graph.encoded_values which is very similar: For example graph.encoded_values=road_environment adds the road_environment encoded value and enables the OSMRoadEnvironment parser. The fundamental difference between graph.flag_encoders and graph.encoded_values is that the 'flag_encoders' add multiple encoded values via VehicleEncodedValuesFactory and a single parser via VehicleTagParserFactory that writes these encoded values, while for each entry in graph.encoded_values there will be a single encoded value added via EncodedValuesFactory and an according single parser via TagParserFactory.

    I don't think this 'minor' difference deserves an extra config option and two extra factories. Let alone it should definitely no longer be called graph.flag_encoders.

  6. easbar commented on Jul 4, 2022

    @easbar
    MemberAuthor

    Another list taken from here: #2561 (comment):

    • Remove special handling of VehicleTagParsers in TagParserBundleOSMParsers (acceptWay method)
    • Remove default encoded values from EncodingManager and default tag parsers in the GraphHopper class
    • Split VehicleTagParsers into speed/access/priority etc. parsers
    • Make curvatureEnc as standalone EV
    • Get rid of VehicleTagParser.init(DateRangeParser)
  7. changed the title [-]Remove FlagEncoder[/-] [+]Remove "FlagEncoder" concept[/+] on Sep 13, 2022
  8. karussell commented on May 15, 2024

    @karussell
    Member

    This should be fixed now.

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

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions