use LocationIq::Object::MatrixApi;
All URIs are relative to https://eu1.locationiq.com/v1
Method | HTTP request | Description |
---|---|---|
matrix | GET /matrix/driving/{coordinates} | Matrix Service |
DirectionsMatrix matrix(coordinates => $coordinates, bearings => $bearings, radiuses => $radiuses, generate_hints => $generate_hints, approaches => $approaches, exclude => $exclude, annotations => $annotations, sources => $sources, destinations => $destinations, fallback_speed => $fallback_speed, fallback_coordinate => $fallback_coordinate)
Matrix Service
Computes duration of the fastest route between all pairs of supplied coordinates. Returns the durations or distances or both between the coordinate pairs. Note that the distances are not the shortest distance between two coordinates, but rather the distances of the fastest routes.
use Data::Dumper;
use LocationIq::MatrixApi;
my $api_instance = LocationIq::MatrixApi->new(
# Configure API key authorization: key
api_key => {'key' => 'YOUR_API_KEY'},
# uncomment below to setup prefix (e.g. Bearer) for API key, if needed
#api_key_prefix => {'key' => 'Bearer'},
);
my $coordinates = "-0.16102,51.523854;-0.15797,51.52326;-0.161593,51.522550"; # string | String of format {longitude},{latitude};{longitude},{latitude}[;{longitude},{latitude} ...] or polyline({polyline}) or polyline6({polyline6}). polyline follows Google's polyline format with precision 5
my $bearings = "10,20;40,30;30,9"; # string | Limits the search to segments with given bearing in degrees towards true north in clockwise direction. List of positive integer pairs separated by semi-colon and bearings array should be equal to length of coordinate array. Input Value :- {bearing};{bearing}[;{bearing} ...] Bearing follows the following format : bearing {value},{range} integer 0 .. 360,integer 0 .. 180
my $radiuses = "500;200;300"; # string | Limits the search to given radius in meters Radiuses array length should be same as coordinates array, eaach value separated by semi-colon. Input Value - {radius};{radius}[;{radius} ...] Radius has following format :- double >= 0 or unlimited (default)
my $generate_hints = "false"; # string | Adds a Hint to the response which can be used in subsequent requests, see hints parameter. Input Value - true (default), false Format - Base64 String
my $approaches = "curb;curb;curb"; # string | Keep waypoints on curb side. Input Value - {approach};{approach}[;{approach} ...] Format - curb or unrestricted (default)
my $exclude = "toll"; # string | Additive list of classes to avoid, order does not matter. input Value - {class}[,{class}] Format - A class name determined by the profile or none.
my $annotations = "distance"; # string | Returns additional metadata for each coordinate along the route geometry. [ true, false (default), nodes, distance, duration, datasources, weight, speed ]
my $sources = 0; # int | Use location with given index as source. [ {index};{index}[;{index} ...] or all (default) ] => index 0 <= integer < #locations
my $destinations = 2; # int | Use location with given index as destination. [ {index};{index}[;{index} ...] or all (default) ]
my $fallback_speed = 25.65; # double | If no route found between a source/destination pair, calculate the as-the-crow-flies distance, then use this speed to estimate duration. double > 0
my $fallback_coordinate = "snapped"; # string | When using a fallback_speed, use the user-supplied coordinate (input), or the snapped location (snapped) for calculating distances. [ input (default), or snapped ]
eval {
my $result = $api_instance->matrix(coordinates => $coordinates, bearings => $bearings, radiuses => $radiuses, generate_hints => $generate_hints, approaches => $approaches, exclude => $exclude, annotations => $annotations, sources => $sources, destinations => $destinations, fallback_speed => $fallback_speed, fallback_coordinate => $fallback_coordinate);
print Dumper($result);
};
if ($@) {
warn "Exception when calling MatrixApi->matrix: $@\n";
}
Name | Type | Description | Notes |
---|---|---|---|
coordinates | string | String of format {longitude},{latitude};{longitude},{latitude}[;{longitude},{latitude} ...] or polyline({polyline}) or polyline6({polyline6}). polyline follows Google's polyline format with precision 5 | |
bearings | string | Limits the search to segments with given bearing in degrees towards true north in clockwise direction. List of positive integer pairs separated by semi-colon and bearings array should be equal to length of coordinate array. Input Value :- {bearing};{bearing}[;{bearing} ...] Bearing follows the following format : bearing {value},{range} integer 0 .. 360,integer 0 .. 180 | [optional] |
radiuses | string | Limits the search to given radius in meters Radiuses array length should be same as coordinates array, eaach value separated by semi-colon. Input Value - {radius};{radius}[;{radius} ...] Radius has following format :- double >= 0 or unlimited (default) | [optional] |
generate_hints | string | Adds a Hint to the response which can be used in subsequent requests, see hints parameter. Input Value - true (default), false Format - Base64 String | [optional] |
approaches | string | Keep waypoints on curb side. Input Value - {approach};{approach}[;{approach} ...] Format - curb or unrestricted (default) | [optional] |
exclude | string | Additive list of classes to avoid, order does not matter. input Value - {class}[,{class}] Format - A class name determined by the profile or none. | [optional] |
annotations | string | Returns additional metadata for each coordinate along the route geometry. [ true, false (default), nodes, distance, duration, datasources, weight, speed ] | [optional] |
sources | int | Use location with given index as source. [ {index};{index}[;{index} ...] or all (default) ] => index 0 <= integer < #locations | [optional] |
destinations | int | Use location with given index as destination. [ {index};{index}[;{index} ...] or all (default) ] | [optional] |
fallback_speed | double | If no route found between a source/destination pair, calculate the as-the-crow-flies distance, then use this speed to estimate duration. double > 0 | [optional] |
fallback_coordinate | string | When using a fallback_speed, use the user-supplied coordinate (input), or the snapped location (snapped) for calculating distances. [ input (default), or snapped ] | [optional] [default to '"input"'] |
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]