Convert coordinate to snapped location

Kia ora,

I need to convert a coordinate [lat, lon] to its snapped equivalent [lat', lon']. Is there a way to do this that is not via the Matrix/Route distance/path search?

I tried via new QueryResult(lat, lon).calcSnappedPoint(), but this requires several different parameters (query distance, closest edge, etc).

Is this simple, or extraordinarily complex?

Ngā mihi,
Mak

Hi @makalakalak,

please provide more context in your topics.
I guess you were the guy that uses the openrouteservice backend as a java library?
There is no function calcSnappedPoint() in the backend. There is getSnappedPoint().

But you are probably looking for something similar to this.

Best regards

Kia ora Amandus,

Apologies - yes, I am using ORS as a Java library.

Thank you for this pointer. I should be able to reverse engineer the code for my purposes.

Appreciate your help.

Ngā mihi,
Mak.