Routing website using Gosmore routing engine

Hi Lambertus,

Thanks for your Code. It’s definitely cool.

Is it possible to resolve 200 km limit, if we install Gosmore to our server?

There is no real hard limit in Gosmore. It’s just my experience that, depending on the road density, Gosmore has more trouble finding a route over longer distances. This is somewhat expected as Gosmore is primarily developed to run on mobile devices which don’t have the storage capabilities to handle such large areas. It also depends on the server, the one behind yournavigation.org only has 2GB ram to serve the whole world which means Gosmore/Linux is constantly swapping bits of the routing database in and out of ram which slows things down considerably. Therefore there is a limit to the time Gosmore is allowed to run on a single route request to prevent a single search to lock the entire server down. Last, the Gosmore instance on yournavigation is old, it might very well be possible that a newer version doesn’t suffer as much from this.

In short: your mileage may vary…

Of course, if you can lay hands on a different routing engine that doesn’t have this drawback then that could probably easily be integrated into YOURS.

Where this time limit? In your code or in Gosmore? As far as I understand, Gosmore has no limit.

Will there be soon a new version of Gosmore?

The limit is in the YOURS code. The commandline that calls Gosmore includes the Linux ‘ulimit’ tool. See http://trac.openstreetmap.org/browser/applications/routing/yours/trunk/www/api/dev/gosmore.php on line 174. Remove that and Gosmore will run as long as it wants.

Gosmore is available through http://wiki.openstreetmap.org/wiki/Gosmore (it points to the OSM svn repository: http://trac.openstreetmap.org/browser/applications/rendering/gosmore)

Thanks a lot

The main developer of gosmore is Nic Roets. I have no idea whethet he is working on gosmore in these days. But when I emailed him about problems and bugs (beside the trac-system) he was answering quickly.

Greets Stephan

The last contribution by Nic was 3 weeks ago, by other developers just 2 hours ago. So yes, Gosmore is definitely in active development.

A little addition to what has been said before: there is no real limit. For instance: Gosmore will be more then happy to route you from Cape Town to Johannesburg (South Africa) which is a 1400km trip, or a 5000km trip through Russia or a 4500km trip crossing Austraia in a few seconds. But routing from the north of the Netherlands to the most southern tip (370 km) will take about 7 seconds when that section of the routing database has been cached in memory (otherwise it will take a while longer, about a minute). It depends on the road network density and available RAM.

The very limited amount of RAM on the server (2 GB) is proving to be a real bottleneck because, ideally, you want everything loaded and cached in RAM. The routing database for Europe, Asia, Africa and Oceania is currently 3.2 GB and North/South America is 4.8 GB. So if you want to do global routing then the server should have at least 8 GB RAM and preferably 12 GB. If you want to provide routing on a country level or smaller (I’m not talking about the USA) then a simple pc or laptop with 4GB RAM might do very well.

I’ve now updated the routing database behind yournavigation.org and moved to the latest Gosmore version. I hope this solves a lot of the routing problems, most noticeably the ‘route via the Southpole’ bug :slight_smile: I think this will make a lot of people happy…

I was looking for a post more specifically inclined to YOURS but this seems to be the closest one I can find… This is actually about using something other than Gosmore for a routing engine.

I just wanted to say that I am excited about the quality of the application this far. It really has some potential to help SMB’s implement highly custom routing applications. I noticed looking at the DEV branch for YOURS that you [Lambertus] are implementing the KIT routing engine. Some months ago I stumbled upon their Google talk and have been interested in seeing it going opensource and being implemented as a backend in YOURS. I have looked over the net for the source code of KIT’s routing engine, but have been unable to locate a public repository. So, I was wondering where your got it so that I may play with the current DEV version of YOURS with KIT.

Thanks,
Michael

Yes, YOURS has always been about implementing other opensource projects. It has never been solely linked to Gosmore, but so far Gosmore has been the only opensource routing engine that suited the purpose. On the other hand, I’ve had very big problems with Gosmore (which seem related to compiler versions, but this isn’t clear yet) so I’ve been a bit more actively seeking for alternatives. So I contacted the researchers from KIT when made an announcement about making their CH routing available for OSM on the OSM routing mailinglist a few months ago. Since then there has been sporadic emailing between them and me and I’ve been testing a few development versions since. They have not released their code yet as they think it’s not the time for that yet, but they have explicitly stated multiple times that it will eventually.

If we compare KIT (that’s the name I have given it, I don’t know how they have named the project) to Gosmore, then there are some striking differences:
KIT uses a very strict hierarchy which cannot be influenced on the fly. This means that they can optimise the hierarchy and achieve incredible speeds (especially much faster then Gosmore over large distances), but you can’t ask it to avoid e.g. toll roads or ferry’s when you included toll roads while constructing the hierarchy. Gosmore on the other hand is flexible, if you provide it with a different stylesheet at runtime then the route outcome will change accordingly. It also allows for a large number of transport types while using the same route database. This gives Gosmore an edge when it comes to providing ‘the whole package’ on a website like YOURS when resources are limited. Yes, routing with Gosmore is slower, but it’s also more versatile.

So, looking into my chrystal ball, I can see a hybrid future where KIT will provide car routing and Gosmore all other transport types, but perhaps Nic Roets can improve Gosmore’s speed as well, who knows. Situations change… I’ll see.

Meanwhile, you can find an implementation of the KIT routing engine in YOURS at: http://www.yournavigation.org/kit/. The routing engine runs on a home computer of one of the researchers and contains the hierarchy for car routing in The Netherlands only, so you can play around a bit if you want. Note: this is development stuff, things might change, break and go offline without notice.

Very cool. Thanks for the quick reply. I think KIT is a good name… or perhaps Routing KIT. Most of the time you only need shortest path only anyway so it should be adequate in most cases. But Gosmore has a very long way from when I started playing with it a little of a year ago. So kudos to the developers for that.

Michael

The first release of the KIT routing engine is out and called OSRM. See the announcement here.

As an almost newbie to OSM world, I’ve taken a look at this topic and it seems that no one here got problem on setting up YOURS. I’ve setup YOURS on my localhost following exactly the wiki’s instruction:

  • install Gosmore into ‘/home/myname/gosmore’ directory
  • download a prebuild map as guided in Gosmore’s wiki page, unzip, name it gosmore.pak and put it in ‘/home/myname/gosmore’
  • put a copy of YOURS into my public html directory, ‘/home/myname/www/yours’
  • correct the two vars of ‘/home/myname/www/yours/api/dev/gosmore.php’, $www_dir = ‘/home/myname/www/yours’; $yours_dir = ‘/home/myname/gosmore’;
    Finally, i opened http://localhost/yours in FF. It appeared to work well but when I marked beginning point (or endpoint) it didn’t display address as well as calculate route at all. I also tested Gosmore alone, and saw it work properly.
    Did I miss doing anything? Can someone help me?

Hi "OpenStreetMap"pers,

I’m using Gosmore in a local routing website, but I have encountered the problem concerning roundabouts: gosmore DOES count oneways entering roundabouts, which is inconvenient. If anyone in this forum has already encountered this problem, and has a solution for it, please let us know about it.

Thanks everyone

Sorry but I don’t understand your problem. Can you elaborate a bit please?

OK, I’ll explain my issue.

I understand that Gosmore gives the routing result as a set of nodes, each node has it’s coordinates and the junction type. If that node is part of a roundabout, the junction type would be “jr”, and if the node is an exit from the roundabout, it would be “Jr”.
The problem is that not all “Jr” nodes are exits; some are enterances.
In the file “libgosm.cpp”, there’s a comment that says:
//TODO: Don’t count oneways entering the roundabout
That’s where I’m stuck, because I need to count the right number of exits from a roundabout.
So, I’ll be very graceful if you can help me with this issue.

Thank you

YOURS is great.

I wonder you difficult it would be to get gosmore to route ski tracks, in particular cross-country ski tracks. There are presently ~ 500 cross-country ski tracks on OSM, they ways that make them up are all tagged with piste:type=nordic (details on http://wiki.openstreetmap.org/wiki/User:Langl%C3%A4ufer/Loipemap - sorry, German only). There is really no other restriction, that tag can be applied to existing (normal) ways - or new ways can be created for those tracks. The latter are not highways of any type, just ways with that tags as described

Any suggestions ? I’m not familiar with the gosmore source code, but I did spot some maybe promising rules in elemstyles.xml - are these only used for rendering or also for routing ?

Thanks,
Armin

I understand YOURS uses Gosmore Routing Engine, but I want to know if there is a way to use Gosmore to “host” the maps, instead of connecting to OSM Tile server (tile.openstreetmap.org), so I can connect YOURS on my web server obtaining the same output as Gosmore?

I have never answered this because I do not develop the routing engine, but I just realise that this should have been my answer: it’s best to contact the author of Gosmore for things like this. Apologies.

Well, there are multiple solutions possible, but this is actually quite easy (depending on all the details like uphill sections etc., but the outlines at least are easy) if you pre-process the data so that you translate ski tracks to highways. Then routing should work out of the box (I assume that you’re using gosmore as routing engine only, not to display the data). There are plenty of C, Perl or Python scripts in the OSM svn repository that can be used as an example for this.

I can imagine a SAX parser that reads from stdin, checks certain ski key/value pairs and replaces them with highways alternatives before outputting to stdout. The stdout can subsequently be read by gosmore for it’s database generation.

An entirely different approach could be to add the ski track key/value pairs in the elemstyles.xml, add e.g. motorcar speeds, remove motorcar speeds for other entries in the elemstyles.xml and request a route for a car. This could be very, very easy but I’m not entirely sure if that would work. But I would certainly try this option first.

I don’t think that is possible. Gosmore renders the OSM data on a canvas of the application. A slippymap like tile.openstreetmap.org is a set of stored and rendered images which are then served using a webserver.

If you want to make sure that Gosmore uses the same data as the underlying map then you can download the planet dump or a planet extract and use that for Gosmore’s database generation AND for your own Mapnik tileserver. But I think it’s quite challenging to setup a local slippymap covering the world (disk space, memory, cpu power, network bandwidth (if you have many users)).