Skip to content

Encode road access per transportation mode #2460

Open

Description

@otbutz

Our current implementation only stores the applicable RoadAccess for cars:

public OSMRoadAccessParser() {
this(new EnumEncodedValue<>(RoadAccess.KEY, RoadAccess.class), toOSMRestrictions(TransportationMode.CAR));
}

There is already an open issue regarding access handling(#1835) but it seems to be more focused on the FlagEncoder/Weighting perspective. Before we can tackle this, we'd need to figure out how we want to store parsed access restrictions for multiple transportation modes in the graph.

Without this we can't properly express truck routing via a CustomModel.

Related: #223

Activity

  1. easbar commented on Nov 19, 2021

    @easbar
    Member

    we'd need to figure out how we want to store parsed access restrictions for multiple transportation modes in the graph.

    We already store access flags for each vehicle. Do you need other 'access' values than true/false (like destination, private, etc.), or what do you mean with "parsed access restrictions"?

  2. otbutz commented on Nov 19, 2021

    @otbutz
    ContributorAuthor

    We already store access flags for each vehicle.

    The more fine-grained logic is only used within the FlagEncoders:

    restrictions.addAll(OSMRoadAccessParser.toOSMRestrictions(getTransportationMode()));

    The RoadAccess EV only represents the access for TransportationMode.CAR:

    if (!em.hasEncodedValue(RoadAccess.KEY)) {
    // TODO introduce road_access for different vehicles? But how to create it in DefaultTagParserFactory?
    _addEdgeTagParser(new OSMRoadAccessParser(), false);
    }

  3. easbar commented on Nov 19, 2021

    @easbar
    Member

    The more fine-grained logic is only used within the FlagEncoders:
    The RoadAccess EV only represents the access for TransportationMode.CAR:

    Yes, but which 'RoadAccess' values do you think should exist for which transportation mode? Currently we have YES,NO,DESTINATION,CUSTOMERS,DELIVERY,FORESTRY,AGRICULTURAL,PRIVATE,OTHER.

    Do we need all of them for e.g. bike and foot? And should something like CarRoadAccess=YES/NO be equivalent to access$car=true/false? Or should we use an encoded value that just represents the tagged OSM value DESTINATION,CUSTOMERS,DELIVERY,FORESTRY,AGRICULTURAL,PRIVATE and YES/NO should only go into the current access flags? And do we need things like access=delivery, but only for truck? This is were this becomes tricky in my opinion and we need to figure out how to deal (or not deal) with access flags in general.

  4. otbutz commented on Dec 1, 2021

    @otbutz
    ContributorAuthor

    If we store this per transportation mode, we can get away with only a subset of those values. The RoadAccess stored in the graph could be simplified to YES, AVOID and NO.

    e.g for car:

    OSM access value RoadAccess
    yes YES
    no NO
    private NO
    permissive YES
    permit NO
    destination AVOID
    agricultural NO
    forestry NO
    delivery NO
    designated YES
    customers AVOID
    discouraged AVOID

    Encoding per transportation mode could also help to improve situations like this one:

    maxweight=3
    maxweight:conditional=none @ delivery
    

    A custom profile for trucks would currently block this road.

  5. karussell commented on Jan 16, 2022

    @karussell
    Member

    If we store this per transportation mode, we can get away with only a subset of those values. The RoadAccess stored in the graph could be simplified to YES, AVOID and NO.

    AVOID is like YES but with preferences which should be customizable. So we can or better should only use true/false IMO.

  6. karussell commented on Mar 3, 2022

    @karussell
    Member

    A custom profile for trucks would currently block this road.

    Conditional tags are likely a different beast (?) How would a custom_model look like if you had a separate truck_access? Wouldn't you need a separate max_weight in this case?

    @otbutz do you have another real world situation, without conditional tags, where the current approach with road_access is problematic for a custom_model for truck?

  7. otbutz commented on Mar 3, 2022

    @otbutz
    ContributorAuthor

    Conditional tags are likely a different beast (?)

    Apart from very simple cases like the one above...totally

    How would a custom_model look like if you had a separate truck_access? Wouldn't you need a separate max_weight in this case?

    Currently the road access is derived from the profile used and thus the type of vehicle/flagencoder. So i need to define and register a truck flagencoder in order to do (customizable) truck routing.

    My idea would be to move access handling out of the flagencoders and promote them to first class encoded values. We already have RoadAccess which looks like a general purpose EV but it only handles TransportationMode.CAR and should rather be named CarRoadAccess.

    But i'm not sure how to properly combine this with our profile approach. Maybe we could let the user define profiles with a more generic transportationmode(e.g TransporationMode.VEHICLE) and allow him to express truck routing in the custom model by targeting e.g TruckRoadAccess

  8. karussell commented on Mar 3, 2022

    @karussell
    Member

    But i'm not sure how to properly combine this with our profile approach. Maybe we could let the user define profiles with a more generic transportationmode(e.g TransporationMode.VEHICLE) and allow him to express truck routing in the custom model by targeting e.g TruckRoadAccess

    A new boolean hgv_access EncodedValue could serve the access (or do we only need car_access and our current hgv?). But what we definitely need and currently cannot configure are the turn restrictions for truck. The OSMTurnRelationParser is already configurable in this regard, but we cannot control this in a server-side profile yet (and would need a java FlagEncoder).

    I.e. it would be nice to be able to write something like:

    profiles:
        - name: truck
          vehicle: car # or: roads
          weighting: custom
          transportation_mode: hgv # or: restrictions: [hgv, motor_vehicle, vehicle, access]
          custom_model: # makes use of hgv_access, max_weight, max_height, hgv, ...
    
  9. otbutz commented on Mar 3, 2022

    @otbutz
    ContributorAuthor

    The problem is that a truck doesn't necessarily translate to "equal or less" in terms of road access compared to car. If the car profile blocks access to delivery, we can't unblock it at runtime.

  10. karussell commented on Mar 3, 2022

    @karussell
    Member

    This is one of the reasons why I specified roads as alternative to car. But IMO the hgv_access shouldn't include delivery as it is a separate property of road_access.

  11. easbar commented on Mar 5, 2022

    @easbar
    Member

    @otbutz I feel like you did not answer my question yet. You said you want to "store parsed access restrictions for multiple transportation modes in the graph." Would it be sufficient to recognize the edges where access is set to no for each transportation mode, like bicycle/motor_vehicle/hgv/...=no, or do you think it is necessary to store the other access values like private/destination/... also per transportation mode? I wonder if we can get away with storing a boolean yes/no for each transportation mode and additionally store one enum with private/destination/delivery/... that is supposed to work for all vehicles. Or in other words: Are there cases where e.g. a way has bicycle=private,motor_vehicle=delivery, and do we need to care?

  12. otbutz commented on Mar 7, 2022

    @otbutz
    ContributorAuthor

    @easbar interesting thought. Our current implementation is mostly blacklist based which would fit a BooleanEncodedValue. The more fine-grained handling is only necessary for RoadAccess values which roughly translate to "avoid if possible". I think we can reduce all OSM access values to either transportation mode specific blocks or mode independent penalties.

    The question is how many gradations of these penalty values we need.

  13. added a commit that references this issue on Dec 1, 2022
  14. bcrawford39GT commented on Sep 20, 2023

    @bcrawford39GT

    Does anyone know how or where to write in: private = avoid , if public path exists?

    Maybe just he Avoid statement does this?

    We are wanting to access private spaces, such as private roads and gated communities , but we don't and to select traveling through these spaces if it is the fasted route and not the origin or destination.

  15. easbar commented on Sep 20, 2023

    @easbar
    Member

    @bcrawford39GT please use our forum for usage related questions.

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