Skip to content
GuidesPlaygroundDashboard

Match GPS coordinates to the road network

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

Match GPS coordinates to the road network

ParametersExpand Collapse
params: MapMatchMatchParams
mapMatchRequest: MapMatchRequest

GPS trace to match against the road network

ReturnsExpand Collapse
class MapMatchResult:

Map matching result with snapped geometry

geometry: GeoJsonGeometry
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
confidence: Optional<Double>

Match confidence score

distance: Optional<Double>

Total matched distance in meters

duration: Optional<Double>

Estimated duration in seconds

type: Type
legs: Optional<List<Leg>>

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

fun main() {
    val client: PlazaClient = PlazaOkHttpClient.fromEnv()

    val params: MapMatchRequest = MapMatchRequest.builder()
        .trace(GeoJsonGeometry.builder()
            .coordinatesOfDoubles(listOf(0.0))
            .type(GeoJsonGeometry.Type.POINT)
            .build())
        .build()
    val mapMatchResult: MapMatchResult = client.mapMatch().match(params)
}
Returns Examples