Snap a coordinate to the nearest road
client.Routing.Nearest(ctx, query) (*NearestResult, error)
GET/api/v1/nearest
Snap a coordinate to the nearest road
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"),
)
nearestResult, err := client.Routing.Nearest(context.TODO(), githubcomplazafyiplazago.RoutingNearestParams{
Lat: githubcomplazafyiplazago.F(0.000000),
Lng: githubcomplazafyiplazago.F(0.000000),
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", nearestResult.Geometry)
}
{
"geometry": {
"coordinates": [
0
],
"type": "Point"
},
"properties": {
"distance_m": 0,
"edge_id": 0
},
"type": "Feature"
}Returns Examples
{
"geometry": {
"coordinates": [
0
],
"type": "Point"
},
"properties": {
"distance_m": 0,
"edge_id": 0
},
"type": "Feature"
}