Snap a coordinate to the nearest road
$client->routing->nearest(float lat, float lng, ?int radius): NearestResult
GET/api/v1/nearest
Snap a coordinate to the nearest road
Snap a coordinate to the nearest road
<?php
require_once dirname(__DIR__) . '/vendor/autoload.php';
$client = new Client(apiKey: 'My API Key', environment: 'local');
$nearestResult = $client->routing->nearest(lat: 0, lng: 0, radius: 0);
var_dump($nearestResult);{
"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"
}