Skip to content
GuidesBlogPlaygroundDashboard

Match GPS coordinates to the road network

$client->mapMatch->match(list<Coordinate> coordinates, ?list<float> radiuses): MapMatchResult
POST/api/v1/map-match

Match GPS coordinates to the road network

ParametersExpand Collapse
coordinates: list<Coordinate>

GPS coordinates to match, in order of travel (max 50 points)

radiuses?:optional list<float>

Search radius per coordinate in meters. Must have the same length as coordinates or be omitted entirely. Default: 50m per point.

ReturnsExpand Collapse
list<Feature> features

Snapped tracepoint Features in input order

list<array<string,mixed>> matchings

Matched sub-routes. Each matching connects a contiguous sequence of tracepoints that could be matched to roads.

Type type

Match GPS coordinates to the road network

<?php

require_once dirname(__DIR__) . '/vendor/autoload.php';

$client = new Client(apiKey: 'My API Key', environment: 'local');

$mapMatchResult = $client->mapMatch->match(
  coordinates: [
    ['lat' => 48.8566, 'lng' => 2.3522],
    ['lat' => 48.857, 'lng' => 2.353],
    ['lat' => 48.8575, 'lng' => 2.354],
  ],
  radiuses: [0],
);

var_dump($mapMatchResult);
{
  "features": [
    {
      "geometry": {
        "coordinates": [
          2.3522,
          48.8566
        ],
        "type": "Point"
      },
      "properties": {
        "distance_m": 0,
        "edge_id": 0,
        "matchings_index": 0,
        "name": "name",
        "original": [
          0,
          0
        ],
        "waypoint_index": 0
      },
      "type": "Feature"
    }
  ],
  "matchings": [
    {
      "foo": "bar"
    }
  ],
  "type": "FeatureCollection"
}
Returns Examples
{
  "features": [
    {
      "geometry": {
        "coordinates": [
          2.3522,
          48.8566
        ],
        "type": "Point"
      },
      "properties": {
        "distance_m": 0,
        "edge_id": 0,
        "matchings_index": 0,
        "name": "name",
        "original": [
          0,
          0
        ],
        "waypoint_index": 0
      },
      "type": "Feature"
    }
  ],
  "matchings": [
    {
      "foo": "bar"
    }
  ],
  "type": "FeatureCollection"
}