## Match GPS coordinates to the road network `client.MapMatch.Match(ctx, body) (*MapMatchResult, error)` **post** `/api/v1/map-match` Match GPS coordinates to the road network ### Parameters - `body MapMatchMatchParams` - `MapMatchRequest param.Field[MapMatchRequest]` GPS trace to match against the road network ### Returns - `type MapMatchResult struct{…}` Map matching result with snapped geometry - `Geometry GeoJsonGeometry` - `Coordinates GeoJsonGeometryCoordinatesUnion` GeoJSON coordinates array (nesting depth varies by geometry type) - `type GeoJsonGeometryCoordinatesArray []float64` - `type GeoJsonGeometryCoordinatesArray [][]float64` - `type GeoJsonGeometryCoordinatesArray [][][]float64` - `type GeoJsonGeometryCoordinatesArray [][][][]float64` - `Type GeoJsonGeometryType` - `const GeoJsonGeometryTypePoint GeoJsonGeometryType = "Point"` - `const GeoJsonGeometryTypeLineString GeoJsonGeometryType = "LineString"` - `const GeoJsonGeometryTypePolygon GeoJsonGeometryType = "Polygon"` - `const GeoJsonGeometryTypeMultiPoint GeoJsonGeometryType = "MultiPoint"` - `const GeoJsonGeometryTypeMultiLineString GeoJsonGeometryType = "MultiLineString"` - `const GeoJsonGeometryTypeMultiPolygon GeoJsonGeometryType = "MultiPolygon"` - `Properties MapMatchResultProperties` - `Confidence float64` Match confidence score - `Distance float64` Total matched distance in meters - `Duration float64` Estimated duration in seconds - `Type MapMatchResultType` - `const MapMatchResultTypeFeature MapMatchResultType = "Feature"` - `Legs []map[string, unknown]` Matched route legs between consecutive trace points ### Example ```go package main import ( "context" "fmt" "github.com/plazafyi/plaza-go" "github.com/plazafyi/plaza-go/option" ) func main() { client := githubcomplazafyiplazago.NewClient( option.WithAPIKey("My API Key"), ) mapMatchResult, err := client.MapMatch.Match(context.TODO(), githubcomplazafyiplazago.MapMatchMatchParams{ MapMatchRequest: githubcomplazafyiplazago.MapMatchRequestParam{ Trace: githubcomplazafyiplazago.F(githubcomplazafyiplazago.GeoJsonGeometryParam{ Coordinates: githubcomplazafyiplazago.F[githubcomplazafyiplazago.GeoJsonGeometryCoordinatesUnionParam](githubcomplazafyiplazago.GeoJsonGeometryCoordinatesArrayParam([]float64{0.000000})), Type: githubcomplazafyiplazago.F(githubcomplazafyiplazago.GeoJsonGeometryTypePoint), }), }, }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", mapMatchResult.Geometry) } ```