Skip to content
Michael Bell edited this page Jul 31, 2023 · 3 revisions

Disabled Datasets is a new unreleased feature that allows you to reduce memory usage.

You can prevent specific datasets being loaded into memory when you do not need the OSRM features provided by those datasets.

Datasets

There are two feature datasets that can be disabled.

ROUTE_GEOMETRY

  • Provides geometry overviews, navigation steps, path annotations, waypoints

  • Disabling this dataset is equivalent to limiting your requests to the following parameters steps=false&overview=false&annotations=false&skip_waypoints=true

ROUTE_STEPS

  • Provides navigation steps

  • Disabling this dataset is equivalent to limiting your requests to the following parameter steps=false

  • Note that disabling ROUTE_GEOMETRY also disables ROUTE_STEPS, you do not need to specify both in your config.

How to disable a feature dataset

Disabling is achieved by providing the OSRM Engine config with a list of feature datasets you wish to disable.

Using shared memory

Provide the disable-feature-dataset argument to osrm-datastore

osrm-datastore --dataset-name=foo_data foo_base_file.osrm --disable-feature-dataset ROUTE_GEOMETRY

You do not need to pass the argument to osrm-routed, it will be ignored.

Using process memory or mmap

Provide the disable-feature-dataset argument to osrm-routed

osrm-routed foo_base_file.osrm --disable-feature-dataset ROUTE_STEPS

Using NodeJS package

Set the disable_feature_dataset array field in the EngineConfig

var osrm = new OSRM({'path': monaco_path, 'disable_feature_dataset': ['ROUTE_GEOMETRY']});

Attempting to use a feature from a disabled dataset

If you attempt to use a feature that is disabled, you will receive a DisabledDatasetException, with a message explaining which dataset you attempted to access.

E.g. making an HTTP request to include navigation steps when ROUTE_STEPS is disabled.

$ curl "http://localhost:5000/route/v1/driving/-0.13286590576171875,51.50863561745838;-0.12119293212890625,51.51889124411907?steps=true"

{"message":"DisabledDatasetException: Your query tried to access the disabled dataset IntersectionBearings. Please check your configuration.","code":"DisabledDataset"}

osrm-routed logs will contain a warning

[2023-07-31T13:40:28.058796467] [warn] [disabled dataset error][140634845328960] code: DisabledDataset_IntersectionBearings, uri: /route/v1/driving/-0.13286590576171875,51.50863561745838;-0.12119293212890625,51.51889124411907?steps=true

The equivalent node request

var osrm = new OSRM({'path': monaco_path, 'disable_feature_dataset': ['ROUTE_STEPS']});
var options = {
    steps: true,
    coordinates: three_test_coordinates.concat(three_test_coordinates),
};
osrm.route(options, function(err, route) {
    console.log(err)
});

> 'DisabledDatasetException: Your query tried to access the disabled dataset IntersectionBearings. Please check your configuration.'