# how gosmore computes the fastest path?

Hi,

I’m a newbie to gosmore and am wondering how gosmore calculates the cost for each path when finding the fastest path.

Does it just assign a speed to each type(primary/secondary/residential/etc.) of road and compute based on that or is there any more sophisticated method to get it?

I know maybe I should look into the code to get the answer. But I would appreciate it so much if anyone gives a hint.

Thanks a lot.

-Elaine

Gosmore uses a style file to define average speeds for each road type, coupled with turn-restrictions and barriers this gives the fastest route. I think the algorithm is a variant on ‘shooting star’.

Thanks so much.
Do you know if gosmore has some function to get the distance/cost for a certain path?

Yes, from memory, the fifth column in the output is the remaining time to destination (which is an indication of the cost for a certain path).

Thanks a lot. This is really helpful. Another question related to this is about the accuracy of the remaining time. Is it the accurate penalty gosmore used when calculating the shortest/fastest path or is it just a coarse estimate? What I’m now doing is to compare the distance gosmore gives between two locations and the distance a given path takes. So I need a relatively accurate estimate of the distance.

Ofcourse it is accurate

But the accuracy depends on the input, which, in this case, is determined by the average speed for each road type as defined in the elemstyle.xml file. For distance finding I use the node coordinates provided by Gosmore and the Great Distance Circle Formula, it appears accurate enough for my purposes.

I see. If I put “fastest = 0” (i.e. shortest path) in the query, could I treat the remaining time as the remaining distance so that I will not have to calculate the distance again? (I only need dist(Path1)/dist(Path2) i.e. the ratio of the distances of one path to another)

Not sure, but I don’t think so, as each segment still has an average speed. But this is only a guess.