Skip to content
GuidesPlaygroundDashboard

Match GPS coordinates to the road network

client.mapMatch.match(MapMatchMatchParams { trace, radiuses } body, RequestOptionsoptions?): MapMatchResult { geometry, properties, type, legs }
POST/api/v1/map-match

Match GPS coordinates to the road network

ParametersExpand Collapse
body: MapMatchMatchParams { trace, radiuses }
trace: GeoJsonGeometry { coordinates, type }

GPS trace (GeoJSON LineString geometry)

coordinates: Array<number> | Array<Array<number>> | Array<Array<Array<number>>> | Array<Array<Array<Array<number>>>>

GeoJSON coordinates array (nesting depth varies by geometry type)

One of the following:
Array<number>
Array<Array<number>>
Array<Array<Array<number>>>
Array<Array<Array<Array<number>>>>
type: "Point" | "LineString" | "Polygon" | 3 more
One of the following:
"Point"
"LineString"
"Polygon"
"MultiPoint"
"MultiLineString"
"MultiPolygon"
radiuses?: Array<number> | null

Search radius per coordinate in meters (optional, default 50)

ReturnsExpand Collapse
MapMatchResult { geometry, properties, type, legs }

Map matching result with snapped geometry

geometry: GeoJsonGeometry { coordinates, type }
coordinates: Array<number> | Array<Array<number>> | Array<Array<Array<number>>> | Array<Array<Array<Array<number>>>>

GeoJSON coordinates array (nesting depth varies by geometry type)

One of the following:
Array<number>
Array<Array<number>>
Array<Array<Array<number>>>
Array<Array<Array<Array<number>>>>
type: "Point" | "LineString" | "Polygon" | 3 more
One of the following:
"Point"
"LineString"
"Polygon"
"MultiPoint"
"MultiLineString"
"MultiPolygon"
properties: Properties { confidence, distance, duration }
confidence?: number

Match confidence score

distance?: number

Total matched distance in meters

duration?: number

Estimated duration in seconds

type: "Feature"
legs?: Array<Record<string, unknown>>

Matched route legs between consecutive trace points

Match GPS coordinates to the road network

import Plaza from '@plazafyi/sdk';

const client = new Plaza({
  apiKey: process.env['PLAZA_API_KEY'], // This is the default and can be omitted
});

const mapMatchResult = await client.mapMatch.match({ trace: { coordinates: [0], type: 'Point' } });

console.log(mapMatchResult.geometry);
Returns Examples