Skip to content
This repository has been archived by the owner on Nov 21, 2024. It is now read-only.

Latest commit

 

History

History
121 lines (96 loc) · 9.6 KB

MatchingApi.md

File metadata and controls

121 lines (96 loc) · 9.6 KB

locationiq.Api.MatchingApi

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

Method HTTP request Description
Matching GET /matching/driving/{coordinates} Matching Service

Matching

DirectionsMatching Matching (string coordinates, string generateHints = null, string approaches = null, string exclude = null, string bearings = null, string radiuses = null, string steps = null, string annotations = null, string geometries = null, string overview = null, string timestamps = null, string gaps = null, string tidy = null, string waypoints = null)

Matching Service

Matching API matches or snaps given GPS points to the road network in the most plausible way. Please note the request might result multiple sub-traces. Large jumps in the timestamps (> 60s) or improbable transitions lead to trace splits if a complete matching could not be found. The algorithm might not be able to match all points. Outliers are removed if they can not be matched successfully.

Example

using System.Collections.Generic;
using System.Diagnostics;
using locationiq.Api;
using locationiq.Client;
using locationiq.Model;

namespace Example
{
    public class MatchingExample
    {
        public static void Main()
        {
            Configuration.Default.BasePath = "https://eu1.locationiq.com/v1";
            // Configure API key authorization: key
            Configuration.Default.AddApiKey("key", "YOUR_API_KEY");
            // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
            // Configuration.Default.AddApiKeyPrefix("key", "Bearer");

            var apiInstance = new MatchingApi(Configuration.Default);
            var 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
            var generateHints = "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 (optional) 
            var approaches = "curb;curb;curb";  // string | Keep waypoints on curb side. Input Value - {approach};{approach}[;{approach} ...] Format - curb or unrestricted (default) (optional) 
            var 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. (optional) 
            var bearings = "None";  // 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) 
            var radiuses = "None";  // 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) 
            var steps = "true";  // string | Returned route steps for each route leg [ true, false (default) ] (optional) 
            var annotations = "false";  // string | Returns additional metadata for each coordinate along the route geometry.  [ true, false (default), nodes, distance, duration, datasources, weight, speed ] (optional)  (default to ""false"")
            var geometries = "polyline";  // string | Returned route geometry format (influences overview and per step) [ polyline (default), polyline6, geojson ] (optional)  (default to ""polyline"")
            var overview = "simplified";  // string | Add overview geometry either full, simplified according to highest zoom level it could be display on, or not at all. [ simplified (default), full, false ] (optional)  (default to ""simplified"")
            var timestamps = "200;300;900";  // string | Timestamps for the input locations in seconds since UNIX epoch. Timestamps need to be monotonically increasing. [ {timestamp};{timestamp}[;{timestamp} ...]  integer seconds since UNIX epoch (optional) 
            var gaps = "ignore";  // string | Allows the input track splitting based on huge timestamp gaps between points. [ split (default), ignore ] (optional)  (default to ""split"")
            var tidy = "false";  // string | Allows the input track modification to obtain better matching quality for noisy tracks. [ true, false (default) ] (optional)  (default to ""false"")
            var waypoints = "0;1;2";  // string | Treats input coordinates indicated by given indices as waypoints in returned Match object. Default is to treat all input coordinates as waypoints. [ {index};{index};{index}... ] (optional) 

            try
            {
                // Matching Service
                DirectionsMatching result = apiInstance.Matching(coordinates, generateHints, approaches, exclude, bearings, radiuses, steps, annotations, geometries, overview, timestamps, gaps, tidy, waypoints);
                Debug.WriteLine(result);
            }
            catch (ApiException e)
            {
                Debug.Print("Exception when calling MatchingApi.Matching: " + e.Message );
                Debug.Print("Status Code: "+ e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Parameters

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
generateHints 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]
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]
steps string Returned route steps for each route leg [ true, false (default) ] [optional]
annotations string Returns additional metadata for each coordinate along the route geometry. [ true, false (default), nodes, distance, duration, datasources, weight, speed ] [optional] [default to ""false""]
geometries string Returned route geometry format (influences overview and per step) [ polyline (default), polyline6, geojson ] [optional] [default to ""polyline""]
overview string Add overview geometry either full, simplified according to highest zoom level it could be display on, or not at all. [ simplified (default), full, false ] [optional] [default to ""simplified""]
timestamps string Timestamps for the input locations in seconds since UNIX epoch. Timestamps need to be monotonically increasing. [ {timestamp};{timestamp}[;{timestamp} ...] integer seconds since UNIX epoch [optional]
gaps string Allows the input track splitting based on huge timestamp gaps between points. [ split (default), ignore ] [optional] [default to ""split""]
tidy string Allows the input track modification to obtain better matching quality for noisy tracks. [ true, false (default) ] [optional] [default to ""false""]
waypoints string Treats input coordinates indicated by given indices as waypoints in returned Match object. Default is to treat all input coordinates as waypoints. [ {index};{index};{index}... ] [optional]

Return type

DirectionsMatching

Authorization

key

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

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 -

[Back to top] [Back to API list] [Back to Model list] [Back to README]