docs/MatrixApi.md

MatrixApi

All URIs are relative to https://eu1.locationiq.com/v1

Method | HTTP request | Description ------------- | ------------- | ------------- Matrix | GET /matrix/driving/{coordinates} | Matrix Service

Matrix

DirectionsMatrix Matrix(coordinates, bearings=var.bearings, radiuses=var.radiuses, generate.hints=var.generate.hints, approaches=var.approaches, exclude=var.exclude, annotations=var.annotations, sources=var.sources, destinations=var.destinations, fallback.speed=var.fallback.speed, fallback.coordinate='"input"')

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.

Example

library(locationiq)

var.coordinates <- '-0.16102,51.523854;-0.15797,51.52326;-0.161593,51.522550' # character | String of format {longitude},{latitude};{longitude},{latitude}[;{longitude},{latitude} ...] or polyline({polyline}) or polyline6({polyline6}). polyline follows Google's polyline format with precision 5
var.bearings <- '10,20;40,30;30,9' # character | 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
var.radiuses <- '500;200;300' # character | 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)
var.generate.hints <- 'false' # character | Adds a Hint to the response which can be used in subsequent requests, see hints parameter. Input Value - true (default), false Format - Base64 String
var.approaches <- 'curb;curb;curb' # character | Keep waypoints on curb side. Input Value - {approach};{approach}[;{approach} ...] Format - curb or unrestricted (default)
var.exclude <- 'toll' # character | Additive list of classes to avoid, order does not matter. input Value - {class}[,{class}] Format - A class name determined by the profile or none.
var.annotations <- 'distance' # character | Returns additional metadata for each coordinate along the route geometry.  [ true, false (default), nodes, distance, duration, datasources, weight, speed ]
var.sources <- 0 # integer | Use location with given index as source. [ {index};{index}[;{index} ...] or all (default) ] => index  0 <= integer < #locations
var.destinations <- 2 # integer | Use location with given index as destination. [ {index};{index}[;{index} ...] or all (default) ]
var.fallback.speed <- 25.65 # numeric | 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
var.fallback.coordinate <- 'input' # character | When using a fallback_speed, use the user-supplied coordinate (input), or the snapped location (snapped) for calculating distances. [ input (default), or snapped ]

#Matrix Service
api.instance <- MatrixApi$new()
# Configure API key authorization: key
api.instance$apiClient$apiKeys['key'] <- 'TODO_YOUR_API_KEY';
result <- api.instance$Matrix(var.coordinates, bearings=var.bearings, radiuses=var.radiuses, generate.hints=var.generate.hints, approaches=var.approaches, exclude=var.exclude, annotations=var.annotations, sources=var.sources, destinations=var.destinations, fallback.speed=var.fallback.speed, fallback.coordinate=var.fallback.coordinate)
dput(result)

Parameters

Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- coordinates | character| 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 | character| 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 | character| 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 | character| 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 | character| Keep waypoints on curb side. Input Value - {approach};{approach}[;{approach} ...] Format - curb or unrestricted (default) | [optional] exclude | character| 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 | character| Returns additional metadata for each coordinate along the route geometry. [ true, false (default), nodes, distance, duration, datasources, weight, speed ] | [optional] sources | integer| Use location with given index as source. [ {index};{index}[;{index} ...] or all (default) ] => index 0 <= integer < #locations | [optional] destinations | integer| Use location with given index as destination. [ {index};{index}[;{index} ...] or all (default) ] | [optional] fallback.speed | numeric| 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 | character| 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"']

Return type

DirectionsMatrix

Authorization

key

HTTP request headers

HTTP response details

| Status code | Description | Response headers | |-------------|-------------|------------------| | 200 | OK | - | | 400 | Bad Request | - | | 401 | Unauthorized | - | | 403 | The request has been made from an unauthorized domain. | - | | 404 | No location or places were found for the given input | - | | 429 | Request exceeded the rate-limits set on your account | - | | 500 | Internal Server Error | - |



location-iq/locationiq-r-client documentation built on Feb. 28, 2020, 9:42 p.m.