Routing website using Gosmore routing engine

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)).

That works nicely, thanks for the hint !

Driving directions documentation.

This is how the instructions is currently implemented in gosmore.php ($showInstructions is configured from the gosmore.php parameters):

if ($showInstructions) {
    $command = $query." ./gosmore ".$pak. " 2>/dev/null | sed 'y/\"/_/' | ".
        "(cd ../routing-instructions/src/tools/translations; LANG=".$lang." ../../../build/src/routing-instructions/routing-instructions --dense 2>/dev/null)";
} else {
    $command = $query." ./gosmore ".$pak. " 2>/dev/null";
}

Test an example by calling e.g. http://www.yournavigation.org/api/dev/route.php?flat=43.917983006&flon=12.86139500&tlat=43.91087897&tlon=12.87468910&fast=1&v=bicycle&instructions=1

Note: route.php is a new script that functions as a proxy for route requests. There are currently two servers running the Gosmore route engine (one provided by yournavigation.org and one provided by Nic Roets - the author of Gosmore). Based on some simple decision rules the requests are relayed to any of the available servers (I could add more servers when they become available, even alternative routing engines if available).

The updated files should appear in SVN soon, but need some stabilising and cleaning up first. The YOURS wiki page will also be updated accordingly ofcourse.

Feature request (in English for general readability). “Openrouteservice.org” has a useful feature, named “Accessibility Analysis”. Could that please be put on the wishlist for Yournavigation.org? Combined with “Cycle routing”? It would even be more useful if combined with an “avoid X” feature; thus, you could use it to find out the results of, for example, construction works, for reachability of places.

Hi All,

I am using YOURS in my web application.Its working fine.
I am showing the total distance for the calculated route, I want to show time for the same. Is this possible?

The time (or route penalty) is not provided by the two routing engines (Gosmore and OSRM/KIT) unfortunately. So I don’t know how to calculate a reasonable accurate time.

Is there any source you know where I can get the idea how to get route penalty for the calculated route.

Well, the route machines know the penalty ofcourse, but they also need to output it so I’d recommend contacting Nic Roets (Gosmore) or Dennis Luxen (OSRM) and ask them to add the information to the output. You can also send them a patch that adds the penalty to the output. Starting point for Gosmore is here and OSRM is here.

Hi All,

I am using Gosmore engine for route calculation.Gosmore uses a .pak file as a database what I want is to use my map database instead of this .pak file.
Is there any way to do this?

Hi All,

As I posted query about “How to calculate Route Penalty(Time) for the trip”, I found Gosmore calculates Route Penalty.

Gosmore
As mention in above link following is the output of Gosmore and it returns 6 fields out of which the 5th one is estimated time, so I just want to confirm whether its Route Penalty(Time)?

Output:
shell> QUERY_STRING=“flat=52.616870&flon=13.228430&tlat=52.601130&tlon=13.245730&fast=0&v=motorcar”
shell> export QUERY_STRING
shell> export LC_NUMERIC en_US
shell> gosmore

Content-Type: text/plain

52.617242,13.227067,J,(unknown-style),84,Zeisgendorfer Weg
52.616851,13.228609,J,(unknown-style),81,Zeisgendorfer Weg
.
.
52.601570,13.243311,J,(unknown-style),5,Heiligenseestraße
52.601548,13.243454,J,(unknown-style),5,Heiligenseestraße

Afaik you can’t do this with Gosmore. I guess you’ll need something like Mapnik/postgresql and pgrouting, but I don’t know if you’re still storing data twice that way. I think you will, and in that case there is no big advantage using Mapnik/postgresql and pgrouting over Mapnik/postgresql and gosmore…

I didn’t now the output contained the time, but if it is then yes: time equals penalty.

Hi Lambertus,

I am still confused whether its Time or not, because if I given the input e.g. Amsterdam to Almere and if i choose a “car” as a vehicle then it will generates 1039 seconds and for same input if I choose “foot” then it will generates 64 seconds and I think its not correct.

Heh, I guess it isn’t actually time, but time related perhaps. In the gosmore stylesheet (that also contains the routing parameters) the routing parameters are something that can be described as ‘speed’. If you choose pedestrian routing you can give a footway a ‘speed’ of 20 and a primary road a ‘speed’ of 1 so that footways are preferred over primary roads. But this example makes it clear that the parameter is not actually ‘speed’ and times cannot accurately be calculated based on these parameters.

It would probably be best to contact Nic Roets about this.