-
Notifications
You must be signed in to change notification settings - Fork 3.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
OSRM distance matrix #544
Comments
There is no such functionality at the moment. I cannot say for future plans, but this could be easily implemented using the plugin interface the project uses. |
I implemented a distance matrix feature already a while back, but did not release the code yet. It is planned, but not yet public. The efficiency is great compared to doing single queries, i.e. 1000x1000 distance tables can be computed in a matter of seconds. Am 19.12.2012 um 00:07 schrieb Matt Sweeney [email protected]:
|
@DennisOSRM sounds great! any chance I could have a look at the unreleased work you've done so far? |
+1 for me. I would be willing to test and bug-fix. This is an important Sent from a mobile phone. Pls xcuse the spelling.
|
Hi @DennisOSRM, any new developments on this front? |
I also am using OSRM for this functionality. A distance matrix would be very helpful. Is there anything that can be done to contribute to this feature? |
There is code for distance matrices, but for the time being, it is closed source. |
I would be very interested in this feature too. And i'm also willing to lend a hand in development/testing/bugfixing. |
Hello, It only supports JSON format outputs, involving an amount of redundancy Feedbacks and suggestions are welcome. Regards, |
Thanks Aquavit, I am currently compiling your fork and testing it against my distance matrix builder. I will comment on your fork further. |
Aquavit, Thanks for sharing first of all. I tried it, and it generates matrices fine (well i tried 20x20) I think the solution DennisOSRM is mentioning is built on re-using the result of the last calculation when planning to (or from) the same location. Anyway that's the solution i'm seeking, ... i need speed. I would try to implement it myself, but it's lower down on my list (not the coming months). Greetings Kees |
jtok202, keesklopt, Thank you for your reply.
Right. My current implementation is a naive double-loop of single routing. So, I admit It's not an ultra-scalable solution (though, I'd like to note it still returns within a second I'm, of course, eager to improvements and would like to see if I can make any progress. |
I'd also be interested in this functionality and glad to help with testing. DennisOSRM, do you intend to integrate your code into OSRM at some point or are you planning to keep it separate? |
It would be a great feature! I'm working in a project in my university and it would be a nice feature to have to finally use OSRM in my project. |
If any of you are interested in a 'times" only matrix implementation you might want to try my version. https://github.com/keesklopt/matrix I have made this a month ago, and had some time now to make it somewhat more accessible for others. Why only times only ? because the weights on which the hierarchy is built are times not distances, and getting the distances means decoding the found path which kills the performance. Since i use it for a subsequent TSP, i have no need for distances until i have calculated the TSP, and i won't need all the distances. To save memory i delete the heap node index as soon as i'm done with it, probably making retrieval of the distances(or path's) very difficult. If you really need distances, it's probably best to alter osrm-prepare to put distances in all shortcuts as well. I cloned project-osrm some days ago, put it in my repository and then added my changes so you will see the alterations clearly. I used the interface code from aquavit as a start, but had to alter it at quite some points. quick-start : git clone http://github.com/keesklopt/matrix Usage example for osrm-routed : And you might need to rebuild your network(s). The interface can't cope with 1000x1000 orders, the returned data seems to be too big. So i only tried 100x100 (1.4seconds). Comments are welcome, |
Kees, |
I actually don't know, for one i have not had an orderset that large to deal with yet. If no one had reacted i'd leave it at that, but i will look into it later today. greetings kees |
Knoepfle thanx for testing, that number of 500 was very helpful. I copied aquavit's code too carelessly, it turns out he has built in a limit for the matrix, see : Plugins/MatrixPlugin.h: 76
That explains a lot. 1000x1000 works fine when you remove the second part of this check. I do not know what happens when you run out of resources, will it be a crash ? Greetings Kees. |
Fantastic, thanks! I can run queries with apparent success up to about 2480 points now (I haven't validated the response data but the queries return full distance matrices). 2500 and up have truncated responses but it could be a problem with my client rather than the server; I'll keep testing and let you know what I find. |
Just a heads-up. A more sophisticated solution (even faster) will arrive at some point. |
Yes, I saw some pdf's about transit node routing coming passed in my searches. Also a very nice technique. But i have a fast enough solution for now to wait for that to come out. Greetings |
I did a 100x100 matrix and tested each "cell" with a single ShortestPathRouting, and that matched. I also put in a 10.000x10.000 test just to see where it would break, but that just ate up all my memory and went on a swapping adventure. So i had to stop that to get my machine back. By the way, i implemented a "randomPhantomNode()" function to get testsets like that, if you are interested i will put that in as well. Greetings Kees |
This would be a great feature for pgRouting integration also. I'm also implementing a call the server N*(N-1) times. In my implementation, I cache the route geometries in the distance so I done have to go and compute them again later. This might be a nice option to include in you implementation. |
Any news about the upcoming distance matrix feature? It will be very helpful since no other services are providing a good distance matrix API |
I implemented this as a postgresql wrapper function. See https://github.com/woodbri/osrm-tools |
I have a good gut feeling that this feature is going to arrive in Q1/14 |
Excellent! Looking forward to it @DennisOSRM! |
+1 Same here :) very much looking forward to this! |
+1 Me too |
Awesome @DennisOSRM, I am also looking forward to this very useful addition to this already great software. |
Since impedance and speed cannot yet be specified separately in the lua profiles, the only way to prioritize certain ways over others is to change the speed, which can lead to unrealistic travel times. |
Looks like this is just a matter of dividing by 10 and rounding. |
Thanks resolved , will try to implement my own version for distance matrix , I want to utilise distances instead of time , will follow above directions. |
@linux-devil check the discussion happening here: #1162 |
Can confirm it works really well on a 700x700 matrix if the hardcoded limit is changed. POST would be good, especially as Apache has a limit of 8190 characters in a URL (which can't be fixed without recompiling), but I'm getting around that with a small proxy script. |
I'm running large matrix, too. There is a plan to set or unlimit the max size by command line option ? a sutch patch will be accepted ? |
I don't think you need a command-line option to set the max size - just the supporting code that ensures large matrices are plausible (i.e. parsing POST requests). |
The limit is not in place to protect osrm-routed to do computation on large matrix and so block the process ? |
In my experience osrm-routed copes very well with large matrices, even on old hardware - it did 700x700 without breaking sweat on my 2009 Mac mini. POST support is the only blocker, though a binary encoding for the returned matrix might be nice to have. |
the limit is to protect of excessive internet traffic. The size of the result grows quadratically with the number of locations. |
I've just learned from this thread about the existence of the 100x100 limit and I just re-compiled as suggested before. Maybe you should consider mentioning the default limit in the API description. I actually spent quite some time before figuring out my problem with big sizes wasn't elsewhere. Anyway thanks for the amazing work, this table feature is awesome ! |
Hi fellows, well i tried to compile the code, manage to do it but it crashes when it comes to extract planet.osm. then i found a precompiled stuff which appears to be working fine. I process the whole planet.osm and setup the server. But a strange thing is happening: viaroute calculation appears to be working. But when i input the distance table example that is on the documentation, which is instead of giving me 0 on the diagonal, it'll give me this {"distance_table":[[922,38499,38901,922],[38675,995,16859,38675],[39212,16818,839,39212],[922,38499,38901,922]]} I recompile the osrm_routed server from fresh code and it ran giving me the same result. What you guy think could be wrong? best regards & thanks |
Fellows, Just as an update. I managed to compile the code following the guidelines on the project page for windows. Then i use a very small dataset taken from geofabrik. The area is Mexico's country. I extracted and prepare the information from a pbf file. then i ran the server and try this query http://localhost:5000/table?loc=19.43680,-99.12733&loc=19.43984,-99.11718 The response was {"distance_table":[[1055,2670],[2478,638]]} Is this ok, Then again the number on the diagonal are wrong. it does not look like the example at all. Did i do something wrong. is the geofabrik info bad? Hope that somebody can give a light on this. best regards to all |
Do you use the latest release v4.4.0? |
Dear Fellows, I am using what i think it is the latest code that can be compiled into windows. The current one won't compile or i'm doing something wrong i the making. Anyway yesterday i managed to isolate the difference in the file ManyToManyRouting.h at this piece of code
the original file i had was like this
I compiled the code and voila, now i got zeroes in the diagonal. Although my finding was good i was wondering if the latest code actually is compatible with vs2013. I follow all the steps in the windows compiling document but there is get the code from a different source than , what i think, is the latest. Any suggestions to compile the latest into windows will be great. I am seeing a lot of improvement which i want to incorporate into my routing. But appart from that i want to congratulate all for such a excellent development best regards |
Oh, right. That totally makes sense. Do you want to file a PR for that change? |
Anything to help! How should i do that properly? |
changed with bec585e |
@linux-devil I 'm as well interested for a distance table in meters. Did you found a solution jet? |
This kind of needs is very good for routing planification / optimization. It could be a good idea to not have only the times, but also the distances for some reports or I don't know ;) |
So just making sure, no distance in meters so far? |
+1 for the distance in meters. |
2 similar comments
+1 for the distance in meters. |
+1 for the distance in meters. |
If you are going to implement meters, could you please make it optional ? |
+1 for the distance in meters. |
1 similar comment
+1 for the distance in meters. |
Locked because of the 👍 noise. |
Heyo!
Is there any equivalent (or plans for one) in OSRM to google's distance matrix? I end up just doing loads of http requests to emulate this functionality, which isn't terribly efficient.
Description of the functionality:
The text was updated successfully, but these errors were encountered: