-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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 Normalized File Format - Read Issues #984
Comments
Also see #825 and you might find https://github.com/woodbri/osrm-tools although it is a little out of date relative the the current release of Project-OSRM as I have not had time to update it and Dennis has #825 somewhere (hopefully) on his todo list. |
@woodbri I saw #825 and a reader or plain text file would be wonderful. The latter does raise performance concerns, but access to the data is better than no access. Can you speak to the accuracy of the wiki - specifically the layout of the edges. Are you are to properly read an OSRM normalized file in your tool (it looks like it geared more towards writing)? Thanks! |
@jlaura Yes my tool is more oriented to writing. I updated the wiki page last time I sync'd my tool with project-osrm, but I suspect that it is out of date again. I had to go through the source code to update it last time. As Project_OSRM becomes more popular getting a clean well supported API is more critical, but until Dennis has time to do something on this front, it will be up to the community to deal with this. |
@woodbri Thanks for the info...to the source I'll go. I appreciate the wikipage to get rolling - thanks for the hard work getting that done. |
Here is a Python script that will parse the Still no information on what is in the header. It looks like a 128 byte UUID followed by a count of the number of edges (padded after 12 bytes), but I'm not 100% sure. Like @woodbri, I just skip it. |
what about an option in osrm-extract and osrm-prepare to export to some stable/standard format? #825 |
I am not sure if we are at this point yet. The .osrm format has been pretty stable, but with all the new and coming features there will be breaking changes. What we could do, though, is using something like protobuf to have some backward compatibility. |
you mean export nodes/edges in protobuffer format? |
Right, the advantage would be to not only have some standardized format with (limited) backward compatibility but also bindings for several programming languages. And we are already using protobuffer for parsing the osm.pbf files. |
can protobuffer be used for saving the contracted graph? or do people only need to extracted graph? |
but yes, that's what i was suggesting, exporting to some standard format |
Good question on what people need. The protobuffer library lets you define schemas for any kind of data to de-/serialize. |
do you have experience with http://kentonv.github.io/capnproto? |
Some limited experience. capnproto is basically the same as protobuf from a functional point of view. That being said, it has a good reputation in terms of efficiency. The only downside is that capnproto would introduce another dependency where protobuf is already used. |
yeah, absolute performance would not be the main goal with an export function. i would stay with pbf |
@emiltin So I can confirm for my use case - the contracted graph is the full graph, but with coincident nodes and edges removed or has some other processing occurred? For my use case - I need access to the nodes, edges (from which I can extract the graph topology), and edge lengths. |
the contracted data is a lot differnet from the basic topology. it's an edge expanded graph that has been contracted using the contraction hierachies algorithm. if you just want the topology, you probably want the output from osrm-extract, which is more like a filtered version of the osm data. |
@emiltin It seems that this discussion should be part of #825 from the point of view of making a stable way to import or export the OSRM files/data. While I'm not opposed to using something like protobuf, there are a lot of advantages to supporting something like simple CSV text files, but that could be achieved with a pbf2txt utility of some kind. Regarding text files, while these are not efficient, efficiency is not the primary goal here but rather accessibility is the goal. Also these only need to be read/written once on transfer so performance is not the issue and they can be written as gzip compressed stream to deal with space efficiency. While my use case does not currently need the contracted graph, I could see this as being potentially useful in the future, but clearly not a high priority in my mind. |
yes i agree it's essentially the same discussion as #825. |
I can speak to @jlaura specific needs but there are a lot of applications that can not be solved today with OSRM that could be solved in pgRouting or potentially other routing engines, for example: adjusting costs or filtering the edges based on traffic or accident data, time based cost adjustments, dynamically supporting different profiles without having multiple instances of OSRM. There are obviously other ways to get OSM data into pgRouting, but in @jlaura case it is a Python app and not pgRouting. |
@jlaura from what I get from your post above, you would need the .osrm file which contains all the segments of the road network. |
@DennisOSRM Sounds like I'm on the right path. My workflow (and the linked gist above) is aimed at extracting the I believe I could also do the extraction myself from the OSM data, but happened upon this project and saw that you were performing that extraction as your first processing phase - which generates the My use case if performing network constrained spatial analysis on nonplanar graphs. The first step is the extraction of the network graph to be used in the generation of an adjacency matrix (contiguity, kernel, or distance based). From the source, it looks like OSRM fulfills the extraction need. |
I am attempting to parse the
.osrm
file to extract the nodes and edges for use in some custom analytics, written in Python. Using the mapping of the normalized file format, I am able to skip the header and read in the edges:I do not need the flags and so am not extracting them.
I can not get reasonable looking edges extracted and am seeing:
Length 0 and negative length make no sense.
.osrm
file the vertex count appears to be a fully 16 bytes (4 for the count and 12 padding), while the edge count is 4 bytes with no padding. Is this correct?The text was updated successfully, but these errors were encountered: