Snap a coordinate to the nearest road
routing().nearest(RoutingNearestParamsparams, RequestOptionsrequestOptions = RequestOptions.none()) : NearestResult
GET/api/v1/nearest
Snap a coordinate to the nearest road
package com.plazafyi.example
import com.plazafyi.client.PlazaClient
import com.plazafyi.client.okhttp.PlazaOkHttpClient
import com.plazafyi.models.routing.NearestResult
import com.plazafyi.models.routing.RoutingNearestParams
fun main() {
val client: PlazaClient = PlazaOkHttpClient.fromEnv()
val params: RoutingNearestParams = RoutingNearestParams.builder()
.lat(0.0)
.lng(0.0)
.build()
val nearestResult: NearestResult = client.routing().nearest(params)
}{
"geometry": {
"coordinates": [
2.3522,
48.8566
],
"type": "Point"
},
"properties": {
"distance_m": 12.4,
"edge_id": 0,
"edge_length_m": 0,
"highway": "highway",
"osm_way_id": 0,
"surface": "surface"
},
"type": "Feature"
}Returns Examples
{
"geometry": {
"coordinates": [
2.3522,
48.8566
],
"type": "Point"
},
"properties": {
"distance_m": 12.4,
"edge_id": 0,
"edge_length_m": 0,
"highway": "highway",
"osm_way_id": 0,
"surface": "surface"
},
"type": "Feature"
}