Skip to content
GuidesPlaygroundDashboard

Match GPS coordinates to the road network

MapMatchResult mapMatch().match(MapMatchMatchParamsparams, RequestOptionsrequestOptions = RequestOptions.none())
POST/api/v1/map-match

Match GPS coordinates to the road network

ParametersExpand Collapse
MapMatchMatchParams params
MapMatchRequest mapMatchRequest

GPS trace to match against the road network

ReturnsExpand Collapse
class MapMatchResult:

Map matching result with snapped geometry

Coordinates coordinates

GeoJSON coordinates array (nesting depth varies by geometry type)

One of the following:
List<double>
List<List<double>>
List<List<List<double>>>
List<List<List<List<double>>>>
Type type
One of the following:
POINT("Point")
LINE_STRING("LineString")
POLYGON("Polygon")
MULTI_POINT("MultiPoint")
MULTI_LINE_STRING("MultiLineString")
MULTI_POLYGON("MultiPolygon")
Properties properties
Optional<Double> confidence

Match confidence score

Optional<Double> distance

Total matched distance in meters

Optional<Double> duration

Estimated duration in seconds

Type type
Optional<List<Leg>> legs

Matched route legs between consecutive trace points

Match GPS coordinates to the road network

package com.plazafyi.example;

import com.plazafyi.client.PlazaClient;
import com.plazafyi.client.okhttp.PlazaOkHttpClient;
import com.plazafyi.models.GeoJsonGeometry;
import com.plazafyi.models.mapmatch.MapMatchMatchParams;
import com.plazafyi.models.mapmatch.MapMatchRequest;
import com.plazafyi.models.mapmatch.MapMatchResult;
import java.util.List;

public final class Main {
    private Main() {}

    public static void main(String[] args) {
        PlazaClient client = PlazaOkHttpClient.fromEnv();

        MapMatchRequest params = MapMatchRequest.builder()
            .trace(GeoJsonGeometry.builder()
                .coordinatesOfNumber(List.of(0.0))
                .type(GeoJsonGeometry.Type.POINT)
                .build())
            .build();
        MapMatchResult mapMatchResult = client.mapMatch().match(params);
    }
}
Returns Examples