NOTICE: is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum

I'm searching for an application or API that does routing. I only need the route and length/time of the route. After doing some research I had the impression gosmore is the appropriate one. I have downloaded and built it according to the wiki I'm using ubuntu 10.04.2 but didn't take the ubuntu one because I want it to run it headless.

First I tried a ready made .pak file to try gosmore out. But whatever QUERY_STRING I've provided, no route is found by gosmore. Then I tried to rebuild the pak file from a german osm data file. First it ended with a 3k sized .pak file. Then I recognized it needs somehow the elemstyles.xml. The next try was to do the rebuild in the source directory of gosmore where all these files are. But doing this

bzcat germany.osm.bz2 | ./gosmore rebuild

I get

488 for (pairs = 0; pairs < PAIRS && s2grp < S2GROUP (0) + S2GROUPS; )
489 for (pairs = 0; pairs < PAIRS && s2grp < S2GROUP (0) + S2GROUPS; )
490 for (pairs = 0; pairs < PAIRS && s2grp < S2GROUP (0) + S2GROUPS; )
491 for (ndType *ndItr = ndBase; ndItr < ndBase + hashTable[bucketsMin1 + 1]; ndItr++)
terminate called after throwing an instance of 'std::bad_alloc'
 what():  std::bad_alloc
Building gosmore.pak using style elemstyles.xml...

So now I'm not really sure to where head next. It is a situation like often that a lot of people seem to use it and are satisified and then there are a few where it doesn't and not much help to solve. Documentation is just not existent.

Did I do something terribly wrong? Is there a better library for routing then gosmore? Any hints appreciated.

asked 14 Apr '11, 12:42

Norbert%20Hartl's gravatar image

Norbert Hartl
accept rate: 0%

Ok, I got something back. Thanks, guys. The conversion of germany osm with gosmore rebuild ate happily 3GB of main memory. Before I only had a little bit more than 2GB free and thought it would be sufficient. So the thing (the error) in my question is due to memory limit. And with the self converted pak file I get routing information while I wasn't successful with the prebuilt paks.

(14 Apr '11, 13:53) Norbert Hartl

This web site is not intended to be a bug tracking system. If you look at Gosmore's Wiki page you will find a reference to the trac system where you can report problems.

If I were to guess from the error message, I'd say maybe your machine has run out of memory. Did you monitor memory usage while running the program?

I think gosmore is well suited for what you have in mind. There are other systems around that you could use just as well, for example Routino or OSRM, both of which are AGPL licensed and support (only) headless operation.

permanent link

answered 14 Apr '11, 12:51

Frederik%20Ramm's gravatar image

Frederik Ramm ♦
accept rate: 23%

Well, often a question looks like a ticket even if it isn't intended :) And it sometimes hard to ask the right things if you are really new to some technology. Thanks for the hint to monitor the memory. I was just assuming it can deal with low mem situation itself. I'm monitoring now

(14 Apr '11, 13:03) Norbert Hartl

My first guess is that you created an incompatible relations.tbl file. If you did, you can delete it and rebuild without it (it is not important for routing).

You can also disable some of the code with the ONLY_ROUTING flag, e.g.

  make CFLAGS='-O2 -DRES_DIR=\"/usr/share/gosmore/\" -DHEADLESS -DONLY_ROUTING'

But it can be a completely unrelated bug.

permanent link

answered 14 Apr '11, 12:53

Nic%20Roets's gravatar image

Nic Roets
accept rate: 6%

edited 14 Apr '11, 13:07

I did not cerate a relations.tbl. I do not know what it is for. And the second line in the log says "Processing without relations table".

(14 Apr '11, 12:58) Norbert Hartl

I'm glad I came back so I found the second option for only routing. Nice now it works. It is just strange (well) that I get only time based information per leg and not distance. Where to ask this? :)

(14 Apr '11, 16:19) Norbert Hartl

Gosmore does not produce the distance because the values used internally are not particularly accurate. Approximating the distances from lat/long is quite easy e.g. using the equirectangular projection. Or you can use the YOURS php wrapper, some versions of which will also generate instructions.

Note that the "time" values are not accurate for shortest route.

(14 Apr '11, 16:40) Nic Roets

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:


question asked: 14 Apr '11, 12:42

question was seen: 6,619 times

last updated: 14 Apr '11, 16:40

NOTICE: is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum