# Map Match ## 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 ### Parameters - `MapMatchMatchParams params` - `MapMatchRequest mapMatchRequest` GPS trace to snap to the road network. Provide an array of coordinate objects representing the GPS points. Maximum 50 points per request. ### Returns - `class MapMatchResult:` Map matching result as a GeoJSON FeatureCollection. Each Feature is a snapped tracepoint. The top-level `matchings` array contains the matched sub-routes connecting consecutive tracepoints. - `List features` Snapped tracepoint Features in input order - `GeoJsonGeometry geometry` GeoJSON Geometry object per RFC 7946. Coordinates use [longitude, latitude] order. 3D coordinates [lng, lat, elevation] are used for elevation endpoints. - `Coordinates coordinates` Coordinates array. Nesting depth varies by geometry type: Point = [lng, lat], LineString = [[lng, lat], ...], Polygon = [[[lng, lat], ...], ...], etc. - `List` - `List>` - `List>>` - `List>>>` - `Type type` Geometry type - `POINT("Point")` - `LINE_STRING("LineString")` - `POLYGON("Polygon")` - `MULTI_POINT("MultiPoint")` - `MULTI_LINE_STRING("MultiLineString")` - `MULTI_POLYGON("MultiPolygon")` - `Properties properties` - `Optional distanceM` Distance from the original GPS point to the snapped point in meters - `Optional edgeId` Road edge ID the point was snapped to - `Optional matchingsIndex` Index into the `matchings` array indicating which matching sub-route this point belongs to - `Optional name` Road name at the snapped point - `Optional> original` Original GPS coordinate as [lng, lat] - `Optional waypointIndex` Index of this tracepoint in the original `coordinates` array - `Type type` - `FEATURE("Feature")` - `List matchings` Matched sub-routes. Each matching connects a contiguous sequence of tracepoints that could be matched to roads. - `Type type` - `FEATURE_COLLECTION("FeatureCollection")` ### Example ```java package com.plazafyi.example; import com.plazafyi.client.PlazaClient; import com.plazafyi.client.okhttp.PlazaOkHttpClient; 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() .coordinates(List.of( MapMatchRequest.Coordinate.builder() .lat(48.8566) .lng(2.3522) .build(), MapMatchRequest.Coordinate.builder() .lat(48.857) .lng(2.353) .build(), MapMatchRequest.Coordinate.builder() .lat(48.8575) .lng(2.354) .build() )) .build(); MapMatchResult mapMatchResult = client.mapMatch().match(params); } } ``` #### Response ```json { "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" } ``` ## Domain Types ### Map Match Request - `class MapMatchRequest:` GPS trace to snap to the road network. Provide an array of coordinate objects representing the GPS points. Maximum 50 points per request. - `List coordinates` GPS coordinates to match, in order of travel (max 50 points) - `double lat` Latitude in decimal degrees (-90 to 90) - `double lng` Longitude in decimal degrees (-180 to 180) - `Optional> radiuses` Search radius per coordinate in meters. Must have the same length as `coordinates` or be omitted entirely. Default: 50m per point. ### Map Match Result - `class MapMatchResult:` Map matching result as a GeoJSON FeatureCollection. Each Feature is a snapped tracepoint. The top-level `matchings` array contains the matched sub-routes connecting consecutive tracepoints. - `List features` Snapped tracepoint Features in input order - `GeoJsonGeometry geometry` GeoJSON Geometry object per RFC 7946. Coordinates use [longitude, latitude] order. 3D coordinates [lng, lat, elevation] are used for elevation endpoints. - `Coordinates coordinates` Coordinates array. Nesting depth varies by geometry type: Point = [lng, lat], LineString = [[lng, lat], ...], Polygon = [[[lng, lat], ...], ...], etc. - `List` - `List>` - `List>>` - `List>>>` - `Type type` Geometry type - `POINT("Point")` - `LINE_STRING("LineString")` - `POLYGON("Polygon")` - `MULTI_POINT("MultiPoint")` - `MULTI_LINE_STRING("MultiLineString")` - `MULTI_POLYGON("MultiPolygon")` - `Properties properties` - `Optional distanceM` Distance from the original GPS point to the snapped point in meters - `Optional edgeId` Road edge ID the point was snapped to - `Optional matchingsIndex` Index into the `matchings` array indicating which matching sub-route this point belongs to - `Optional name` Road name at the snapped point - `Optional> original` Original GPS coordinate as [lng, lat] - `Optional waypointIndex` Index of this tracepoint in the original `coordinates` array - `Type type` - `FEATURE("Feature")` - `List matchings` Matched sub-routes. Each matching connects a contiguous sequence of tracepoints that could be matched to roads. - `Type type` - `FEATURE_COLLECTION("FeatureCollection")`