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
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{
Coordinates: githubcomplazafyiplazago.F([]githubcomplazafyiplazago.MapMatchRequestCoordinateParam{githubcomplazafyiplazago.MapMatchRequestCoordinateParam{
Lat: githubcomplazafyiplazago.F(48.856600),
Lng: githubcomplazafyiplazago.F(2.352200),
}, githubcomplazafyiplazago.MapMatchRequestCoordinateParam{
Lat: githubcomplazafyiplazago.F(48.857000),
Lng: githubcomplazafyiplazago.F(2.353000),
}, githubcomplazafyiplazago.MapMatchRequestCoordinateParam{
Lat: githubcomplazafyiplazago.F(48.857500),
Lng: githubcomplazafyiplazago.F(2.354000),
}}),
},
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", mapMatchResult.Features)
}
{
"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"
}Returns Examples
{
"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"
}