Create a new FlagEncoder

I’am trying to add a new FlagEncoder to ORS, i’am wondering if there’s a documentation somewhere that can help.

Regards.

I do not think we have documentation for that, sorry.

Cheers

1 Like

Hi @HendrikLeuschner,

I succeffully create a new FlagEncoder (driving-hgv-custom), therfore i have now two hgv profiles (driving-hgv and driving-hgv-custom). How can i generate both profiles?

I tried this in the app.config but it didnt work

  "profile-hgv": {
             "profiles": "driving-hgv, driving-hgv-custom",

app.config

{
  "ors": {
    "info": {
      "base_url": "https://openrouteservice.org/",
      "support_mail": "support@openrouteservice.org",
      "author_tag": "openrouteservice",
      "content_licence": "LGPL 3.0"
    },
    "services": {
      "routing": {
        "enabled": true,
        "mode": "normal",
        "routing_description": "This is a routing file from openrouteservice",
        "routing_name": "openrouteservice routing",
        "sources": ["openrouteservice/src/main/files/midi.osm.pbf"],
        "init_threads": 2,
        "attribution": "openrouteservice.org, OpenStreetMap contributors",
        "elevation_preprocessed": false,
        "profiles": {
          "active": [
            "hgv"
          ],
          "default_params": {
            "encoder_flags_size": 8,
            "graphs_root_path": "graphs",
            "elevation_provider": "multi",
            "elevation_cache_path": "cgiar_provider",
            "elevation_cache_clear": false,
            "instructions": true,
            "maximum_distance": 400000,
            "maximum_distance_dynamic_weights": 400000,
            "maximum_distance_avoid_areas": 400000,
            "maximum_waypoints": 50,
            "maximum_snapping_radius": 400,
            "maximum_avoid_polygon_area": 200000000,
            "maximum_avoid_polygon_extent": 20000,
            "maximum_distance_alternative_routes": 400000,
            "maximum_alternative_routes": 3,
            "maximum_distance_round_trip_routes": 400000,
            "maximum_speed_lower_bound": 80,
            "preparation": {
              "min_network_size": 200,
              "min_one_way_network_size": 200,

              "methods": {
                "lm": {
                  "enabled": true,
                  "threads": 1,
                  "weightings": "recommended,shortest",
                  "landmarks": 16
                }
              }
            },
            "execution": {
              "methods": {
                "lm": {
                  "disabling_allowed": true,
                  "active_landmarks": 8
                }
              }
            }
          },
          "profile-hgv": {
           "profiles": "driving-hgv, driving-hgv-custom",
            "parameters": {
              "encoder_flags_size": 8,
              "encoder_options": "turn_costs=true|block_fords=false|use_acceleration=false",
              "maximum_distance": 400000,
              "elevation": true,
              "preparation": {
                "min_network_size": 200,
                "min_one_way_network_size": 200,

                "methods": {
                  "ch": {
                    "enabled": true,
                    "threads": 1,
                    "weightings": "recommended"
                  },
                  "lm": {
                    "enabled": true,
                    "threads": 1,
                    "weightings": "recommended,shortest",
                    "landmarks": 16
                  },
                  "core": {
                    "enabled": true,
                    "threads": 1,
                    "weightings": "recommended,shortest",
                    "landmarks": 64,
                    "lmsets": "highways;allow_all"
                  }
                }
              },
              "execution": {
                "methods": {
                  "ch": {
                    "disabling_allowed": true
                  },
                  "lm": {
                    "disabling_allowed": true,
                    "active_landmarks": 6
                  },
                  "core": {
                    "disabling_allowed": true,
                    "active_landmarks": 6
                  }

                }
              },
              "ext_storages": {
                "WayCategory": {},
                "HeavyVehicle": {
                  "restrictions": true
                },
                "WaySurfaceType": {}
              }
            }
          }
          
        }
      }
    },
    "logging": {
      "enabled": true,
      "level_file": "DEBUG_LOGGING.json",
      "location": "/var/log/ors",
      "stdout": true
    },
    "system_message": [
        {
            "active": false,
            "text": "This message would be sent with every request for geojson response",
            "condition": {
                "api_format": "geojson"
            }
        },
        {
            "active": false,
            "text": "This message would be sent with every request on API v1 from January 2020 until June 2050",
            "condition": {
                "api_version": 1,
                "time_after": "2020-01-01T00:00:00Z",
                "time_before": "2050-06-01T00:00:00Z"
            }
        },
        {
            "active": false,
            "text": "This message would be sent with every request"
        }
    ]
  }
}

Hi @hamzarhaiem,

i did something similar for my bachelor thesis.
Maybe take a look at this and you will find where you need to set things:

This is based on a very old ors version so you might have to adjust some things before it will work

1 Like