snapToRoads method
This service returns the best-fit road geometry for a given set of GPS coordinates. This service takes up to 100 GPS points collected along a route, and returns a similar set of data with the points snapped to the most likely roads the vehicle was traveling along. Optionally, you can request that the points be interpolated, resulting in a path that smoothly follows the geometry of the road.
Implementation
Future<Response<SnapToRoadsResponse>> snapToRoads(
BuiltList<String> path, {
bool? interpolate,
CancelToken? cancelToken,
Map<String, dynamic>? headers,
Map<String, dynamic>? extra,
ValidateStatus? validateStatus,
ProgressCallback? onSendProgress,
ProgressCallback? onReceiveProgress,
}) async {
final _request = RequestOptions(
path: r'/v1/snapToRoads',
method: 'GET',
headers: <String, dynamic>{
...?headers,
},
queryParameters: <String, dynamic>{
r'path': path,
if (interpolate != null) r'interpolate': interpolate,
},
extra: <String, dynamic>{
'secure': <Map<String, String>>[
{
'type': 'apiKey',
'name': 'ApiKeyAuth',
'keyName': 'key',
'where': 'query',
},
],
...?extra,
},
validateStatus: validateStatus,
contentType: 'application/json',
cancelToken: cancelToken,
onSendProgress: onSendProgress,
onReceiveProgress: onReceiveProgress,
);
dynamic _bodyData;
final _response = await _dio.request<dynamic>(
_request.path,
data: _bodyData,
options: Options(
method: _request.method,
sendTimeout: _request.sendTimeout,
receiveTimeout: _request.receiveTimeout,
extra: _request.extra,
headers: _request.headers,
responseType: _request.responseType,
contentType: _request.contentType,
validateStatus: _request.validateStatus,
receiveDataWhenStatusError: _request.receiveDataWhenStatusError,
followRedirects: _request.followRedirects,
maxRedirects: _request.maxRedirects,
requestEncoder: _request.requestEncoder,
listFormat: _request.listFormat,
),
);
const _responseType = FullType(SnapToRoadsResponse);
final _responseData = _serializers.deserialize(
_response.data,
specifiedType: _responseType,
) as SnapToRoadsResponse?;
return Response<SnapToRoadsResponse>(
data: _responseData,
headers: _response.headers,
isRedirect: _response.isRedirect,
requestOptions: _response.requestOptions,
redirects: _response.redirects,
statusCode: _response.statusCode,
statusMessage: _response.statusMessage,
extra: _response.extra,
);
}