-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Disabled Datasets
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.
There are two feature datasets that can be disabled.
-
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
-
Provides navigation steps
-
Disabling this dataset is equivalent to limiting your requests to the following parameter
steps=false
-
Note that disabling
ROUTE_GEOMETRY
also disablesROUTE_STEPS
, you do not need to specify both in your config.
Disabling is achieved by providing the OSRM Engine config with a list of feature datasets you wish to disable.
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.
Provide the disable-feature-dataset
argument to osrm-routed
osrm-routed foo_base_file.osrm --disable-feature-dataset ROUTE_STEPS
Set the disable_feature_dataset
array field in the EngineConfig
var osrm = new OSRM({'path': monaco_path, 'disable_feature_dataset': ['ROUTE_GEOMETRY']});
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.'