Routing website using Gosmore routing engine

I was doing some routing near my parents’ place, and noted something odd. When choosing the ‘cycling-fastest’ option, it provided me with a route that was not only longer but also slower than the ‘cycling-shortest’ gave. Why this behaviour? (if you want to check: It’s in the village of Drouwen, going from the three-way crossing Hoofdstraat-Lemenweg-Stobbenweg in the east of the village to the crossing Lemenweg-Gasselterstraat-Drouwenerstraat, further to the (north)east. The shortest route was 1.86 km, taking 307 seconds, the fastest route 2.40 km, taking 615 seconds).

’ Fastest’ is a different algorithm then ‘shortest’, as it uses time penalties to determine the fastest route instead of distance to find the shortest route.

The speeds on different road types are configured and for cars the higher the road class the higher the speed. But I did not want to do that for bicycle routing, I configured cycleways as the fastest road type, then unclassified, tertiary, secondary etc. Therefore, in bicycle mode, the router prefers cycleways and unclassified ways.

Does this explain the behaviour you’re seeing?

Yes, I understand that. But based on that I find it strange that the shortest route is faster than the fastest one (as well as shorter).

Not really, the shortest route uses a tertiary road, the fastest route a (longer) track (more precise data: The shortest route is 1.1 miles of tertiary, the fastest one is 0.4 miles tertiary, 1.0 miles track, 0.1 miles tertiary). And, as said, the outcome for the fastest route was not only longer, but also slower than the one for the shortest route.

I found another strange behaviour now, by the way: In this case the fastest and the shortest route were the same, but where the shortest route was 0.34 km, taking 57 seconds, the fastest one was 0.34 km as well, but took 233 seconds. Surely when getting the same route, they should give the same data for travel time as well as length, no?

Checking everything again, I see that apparently ‘fastest route’ uses a different speed determination than ‘shortest route’, and that my issue does indeed seem to depend on the values given to the various roads - track being much higher scaled and tertiary much lower than I would have thought. Making an estimate of the various speeds, it seems to come around something like this (precise numbers can’t be given, because different trajectories give different values - I assume this is because there is something like a penalty for crossings or somesuch

cycleway: 23 km/h
track: 20 km/h
residential: 20 km/h (more unsure than the others because I have not checked any long stretches)
unclassified: 18-19 km/h
tertiary: 12 km/h
secondary: 11 km/h
primary: 10 km/h
service: 9 km/h

My second issue was probably because there was a road with “highway=pedestrian, bicycle=yes” which was calculated as if it had to be walked (5 km/h) despite the ‘bicycle=yes’ specification.

Some more: cycleway=lane and cycleway=track both did not seem to change the speed of the road. A road with oneway=yes, cycleway=opposite was the same speed in both directions.

I think these speeds can be a lot improved - in my opinion, the gap between tertiary and unclassified is too large, track is (much) too high, service (much) too low (I have seen excellent bicycle roads tagged as service because they were “destination only” for motor vehicles).

The server is currently not available (it’s not responding). It may possibly be down because of a DoS (intentional or unintentional) as I see a huge spike in Apache accesses on the routing server before route requests stop coming through. I have no idea when the server will be back online.

For anyone who is running some sort of script against the routing server: please stop it and send me an email: osm at na1400 dot info

Edit: The server is up and running again.

Edit: Wow, on the 19th October yournavigation.org handled 625.000 unique route requests plus 100.000 cached requests, that’s more then 8 requests per second on average :sunglasses:

Hello there. The routing service does not seem to be working in the Detroit area, and possibly the whole U.S. It does appear to be working in Europe.
Requests in the U.S. return the following as HTML:

Notice: Undefined index: content_type in /home/lambertus/public_html/yours/api/dev/route.php on line 188

Harold Ship

Thanks for the report.

It looks like the server that was providing routing for the America’s has been disabled (I get timeouts trying to login). This was a sponsored server and the server has been provided for far longer then originally agreed upon, so I’m not complaining. I’ve made a change so that all route requests for the America’s is handled by one of the two remaining servers. The routing database for the America’s on that server is quite old though…

Sorry for any inconvenience.

Anyone with a server or VM to spare that has 32 GB ram is more then welcome to contact me.

Thanks for your quick reply! It is working now. :slight_smile:

Hi (I also posted this in gosmore topic)

I’m trying to rebuild the north american database for gosmore on Ubuntu Saucy (using the version from universe repo). How long does it take, and how do I know if it is still working?

I started it around 24 hours ago. Top shows gosmore is using 100% of CPU, but as of right now, it stopped writing to /usr/share/gosmore directory more than 12 hours ago.

The output on the console:

Building gosmore.pak using style elemstyles.xml...
Icon public.png not found
Icon public.png not found
Icon religion/synagogue.png not found
Icon religion/mosque.png not found
Icon rendering/landuse/cemetery.png not found
Icon wlan.png not found
Icon rendering/landuse/cemetery.png not found
  1 while (xmlTextReaderRead (xml) == 0
  2 while (fread (&nd, sizeof (nd), 1, groupf[i]) == 1)
  3 while (fread (s, sizeof (s), 1, groupf[i + NGROUPS]) == 1)
  4 while (fread (&nd, sizeof (nd), 1, groupf[i]) == 1)
  5 while (fread (s, sizeof (s), 1, groupf[i + NGROUPS]) == 1)
  6 while (fread (&nd, sizeof (nd), 1, groupf[i]) == 1)
  7 while (fread (s, sizeof (s), 1, groupf[i + NGROUPS]) == 1)
  8 while (fread (&nd, sizeof (nd), 1, groupf[i]) == 1)
  9 while (fread (s, sizeof (s), 1, groupf[i + NGROUPS]) == 1)
 10 while (fread (&nd, sizeof (nd), 1, groupf[i]) == 1)

doublepost of haroldship … see Q&A sub forum here.

Hello dear

A friend and I working in the new multimodal bus transport public maps in Bogotá city (Colombia)

We are graphic designers (no know programing)

I am testing the public transport with http://www.yournavigation.org/ and no working fine, I no understand what is doing…

I like me know it is possible send the KMLs maps we are doing and if is possible use public transport system using this maps

I think when the results show, should be show the number of bus route in the map

Thanks for your help

Public transport (i.e. bus/train/metro routes and time schedules) is not supported on yournavigation.org. The option ‘public service’ is just for routing over ways that allow public service. In OSM mapping speak these are the ways that are labelled: psv=* (and probably emergency=*, but I’m not sure at this moment).

The Gosmore routing engine only performs least-cost routing based on road speeds for each type of transport. It doesn’t support public transport routes or time schedules. Perhaps it’s possible to pre-process the data to make Gosmore work ‘sort-of’ but it will never be good at it. You’d better find a different routing engine that is specifically built to handle this type of transport.

I got my local copy of YOURS up and running! I had some issues though. I opened a bug here: https://trac.openstreetmap.org/ticket/5113

Congratulations!

I don’t really understand why you need a fix, for updating the whole planet works well without the patch. Have you made changes to the elemstyle.xml?

Perhaps a list of all the issues I encountered get YOURS going would help. Many are just differences between the instructions and what I had to do. Other were actual changes I had to make that are bugs.

Setup:
VM with 4 cores, 16GB RAM, 120GB hard disk. Ubuntu Saucy (13.10).

Gosmore:

  • First I tried to install it on RHEL. Gave up because I could not get required libraries installed.
  • Moved to Ubuntu, because I saw that gosmore is part of the universe repo.
  • Tried to build the planet, died on disk space.
  • Tried to build americas, stuck in infinite loop with 100%CPU
  • Tried to build from source - core dump on ‘make install’ so opened https://trac.openstreetmap.org/ticket/5110
  • Fixed the above on my local machine, built americas. Had already replaced elemstyles.xml with http://www.yournavigation.org/elemstyles.xml.routing which you sent me.

RoutingInstructions:

  • Tried to install RoutingInstructions - some errors in their instructions. Opened bug (already fixed)

YOURS:

  • Tried to install YOURS - web site opened but routing api (both 1.0 and dev) fail.
  • yours.js refers to api/dev/route.php but only found gosmore.php. created a symlink.
  • location of gosmore executable is hard-coded in gosmore.php. It’s different for 1.0 and dev. I created 2 symlinks.
  • names and locations of gosmore americas.pak and eurasia.pak files are hard-coded in gosmore.php.
  • names and locations of styles files are hard-coded in gosmore.php. Used the above for all 3.
  • GeoJSON returned by api/1.0/gosmore.php is not valid (spurious comma on last coordinate)
  • fixed above locally (api/dev version is ok)
  • Opened a bug https://trac.openstreetmap.org/ticket/5113

In the YOURS section, I believe a few updates in the doc would save the next installer from having to debug the scripts. In particular, it could state that gosmore executable or link to it must be in the yours directory, and what the names and locations of the .pak files are.

For the xml files, I don’t know what the difference should be. It would be helpful if they were included in the repo with instructions on where to put them.

Regarding the spurious comma in api/1.0/gosmore.php, it is a bug that prevents GeoJSON from working in 1.0.

In any case, the site is up and running. My teammates and managers are really impressed - it works beautifully. I plan to add the eurasia database some time in the future.

Thanks for all your help along the way,
Harold Ship

Hah, thanks for the writeup.

I know that YOURS isn’t very easy to setup and not everything is consistent, but it’s nice to see that someone else can make it work by fixing (mainly) a few hard-coded paths. Thanks also for the bugreports :slight_smile:

Regarding elemstyles.xml: I built the gosmore.pak twice. Once with the default elemstyles and one with only routing related info. The resulting PAK files were identical in size, so it appears not to make a difference when using Gosmore with the compiler option ROUTING_ONLY enabled.

The website seems to be out of service: http://www.yournavigation.org/

:confused:

Hi all

I am running a local copy of YOURS, and my users have noticed that my APIs don’t return ‘traveltime’, although the hosted version at http://www.yournavigation.org does.
Is there something I need to do to get this working?

Harold Ship

Also replied by email yesterday, but for completeness my answer:

The Gosmore routing engine provides an estimated time to destination on each node in it’s output. The first node in Gosmore’s output should contain the total trip time (Gosmore outputs the route in reverse order).

See the documentation of the output elements here:
http://wiki.openstreetmap.org/wiki/Gosmore#Cgi_Routing_Interface

I hope this helps.

Harold,

I had the same problem and Lambertus was kind enough to send me his version of the gosmore.php file. Note that you will need to update his local path references (shown below) to your settings:


…
// Geographic pak file selection
$pak = '';
if ($flon < -30) {
	// American continents (North and South)
	$pak = '/home/lambertus/gosmore/america/gosmore.pak';
} else {
	// Europe, Asia, Africa and Oceania continents
	$pak = '/home/lambertus/gosmore/eurasia/gosmore.pak';
}

if (file_exists($pak)) {
	$dir = '/home/lambertus/gosmore/';
…

You will also need another file called geography.class.php which needs to be in the same directory as the gosmore.php file. I’ll send you both files in an email. (i’d post them here but don’t see an option - anyone who can can help me with posting these files here…?)

  - hp -