Closed Eichenherz closed 1 month ago
@Eichenherz Without modifying OSRM's code, you can't.
Internally, OSRM stores a flat std::vector
I've been considering how we could expose more compact representations, but there has been no work done so far. Unless you're willing to modify OSRM C++ code, there is no way to get the data in non-JSON format currently.
If there's no other way, then I'll modify the code. Where should I look exactly ?
Here: https://github.com/Project-OSRM/osrm-backend/blob/master/src/engine/plugins/table.cpp#L157
On this line, the result_tables_pair
vector is fully populated with results. The .MakeResponse
function converts that and packs it into the result
object in JSON form.
The easiest thing to do would be to dive into .MakeResponse
and have it serialize out a Buffer
or some other flat structure. Check the tile.cpp
plugin for an example of how to return binary data.
Is this feature (exposing raw data) planned for the future?
I use osrm-backend with a homemade Scala/JNI wrapper and avoid the passage through JSON would be very nice.
This issue seems to be stale. It will be closed in 30 days if no further activity occurs.
I need a matrix/table of distances between coords to pass to a VRP Solver. This is the format: std::vector<std::vector> .
I know OSRM does provide such a table, but it returns a JSON object, I don't need this, since I want to feed the table right into the Solver ( same .exe ).
How can I do this ? Without converting back & forth to JSON