Table
Compute distance/duration table between coordinates.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
coordinates
|
List of (lon, lat) tuples or TableParameters object |
None
|
|
sources
|
Indices of source coordinates |
required | |
destinations
|
Indices of destination coordinates |
required | |
annotations
|
'duration', 'distance', or both |
required | |
fallback_speed
|
Fallback speed in km/h |
required | |
fallback_coordinate
|
Coordinate fallback: 'input' or 'snapped' |
required | |
scale_factor
|
Scale factor for durations |
required | |
radiuses
|
Search radius in meters for each coordinate |
required | |
bearings
|
Bearing constraints |
required | |
hints
|
Hints from previous request |
required | |
approaches
|
Approach constraints |
required | |
exclude
|
Road classes to avoid |
required | |
generate_hints
|
Generate hints for response |
required | |
snapping
|
Snapping mode |
required |
Returns:
| Type | Description |
|---|---|
|
Table result as osrm.Object |
Source code in osrm/__init__.py
Table Parameters
Bases: osrm.osrm_ext.BaseParameters
Overloaded function.
__init__(self) -> None
Instantiates an instance of TableParameters.
Examples:
>>> table_params = osrm.TableParameters(
coordinates = [(7.41337, 43.72956), (7.41546, 43.73077)],
sources = [0],
destinations = [1],
annotations = ['duration'],
fallback_speed = 1,
fallback_coordinate_type = 'input',
scale_factor = 0.9
)
>>> table_params.IsValid()
True
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sources
|
list of int
|
Use location with given index as source. (default []) |
required |
destinations
|
list of int
|
Use location with given index as destination. (default []) |
required |
annotations
|
list of 'none' | 'duration' | 'distance' | 'all'
|
Returns additional metadata for each coordinate along the route geometry. (default []) |
required |
fallback_speed
|
float
|
If no route found between a source/destination pair, calculate the as-the-crow-flies distance, then use this speed to estimate duration. (default INVALID_FALLBACK_SPEED) |
required |
fallback_coordinate_type
|
string 'input' | 'snapped'
|
When using a fallback_speed, use the user-supplied coordinate (input), or the snapped location (snapped) for calculating distances. (default '') |
required |
scale_factor
|
Scales the table duration values by this number (use in conjunction with annotations=durations). (default 1.0) |
required | |
BaseParameters
|
BaseParameters
|
Keyword arguments from parent class. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
__init__ |
TableParameters
|
A TableParameters object, for usage in Table. |
IsValid |
bool
|
A bool value denoting validity of parameter values. |
Attributes:
| Name | Type | Description |
|---|---|---|
sources |
list of int
|
Use location with given index as source. |
destinations |
list of int
|
Use location with given index as destination. |
annotations |
string
|
Returns additional metadata for each coordinate along the route geometry. |
fallback_speed |
float
|
If no route found between a source/destination pair, calculate the as-the-crow-flies distance, then use this speed to estimate duration. |
fallback_coordinate_type |
string
|
When using a fallback_speed, use the user-supplied coordinate (input), or the snapped location (snapped) for calculating distances. |
scale_factor |
string
|
Scales the table duration values by this number (use in conjunction with annotations=durations). |
BaseParameters |
BaseParameters
|
Attributes from parent class. |
__init__(self, sources: collections.abc.Sequence[int] = [], destinations: collections.abc.Sequence[int] = [], annotations: collections.abc.Sequence[osrm.osrm_ext.TableAnnotationsType] = [], fallback_speed: float = 3.4028234663852886e+38, fallback_coordinate_type: osrm.osrm_ext.TableFallbackCoordinateType = '', scale_factor: float = 1.0, coordinates: collections.abc.Sequence[osrm.osrm_ext.Coordinate] = [], hints: collections.abc.Sequence[std::optional<osrm::engine::Hint>] = [], radiuses: collections.abc.Sequence[osrm.osrm_ext.OptionalDouble] = [], bearings: collections.abc.Sequence[osrm.osrm_ext.OptionalBearing] = [], approaches: collections.abc.Sequence[osrm.osrm_ext.OptionalApproach] = [], generate_hints: bool = True, exclude: collections.abc.Sequence[str] = [], snapping: osrm.osrm_ext.SnappingType = '') -> None