Opened 6 years ago

Last modified 6 years ago

#4930 new enhancement

tracktypes for bicycle

Reported by: travelling_salesman Owned by: nroets@…
Priority: minor Milestone:
Component: gosmore Version:
Keywords: tracktype Cc:

Description

I prepared the following patch to consider the tracktype tag for bicycles as well as for pedestrians. Previously it was only considered for motorcars.

file: gosmore/jni/libgosm.cpp 1506,1509c1506,1514 < if (k2vtracktype? && isdigit (k2vtracktype?[5])) { < s.aveSpeed[motorcarR] *= ('6' - k2vtracktype?[5]) / 5.0; < Alternatively use ... (6 - atoi (k2vtracktype? + 5)) / 5.0; < TODO: Mooaar ---

if ((k2vtracktype? && isdigit (k2vtracktype?[5]))

strcmp (k2vhighway?, "track") == 0) { many tracks don't have a tracktype, assume them as rather slow int tracktype = 2; if (k2vtracktype? && isdigit (k2vtracktype?[5]))

tracktype = atoi (k2vtracktype? + 5);

s.aveSpeed[motorcarR] *= (6 - tracktype) / 5.0; if (tracktype >= 3) s.aveSpeed[bicycleR] *= (6 - tracktype) / 4.0; if (tracktype == 5) s.aveSpeed[footR] *= 0.8;

Change History (1)

comment:1 Changed 6 years ago by travelling_salesman

file: gosmore/jni/libgosm.cpp

1506,1509c1506,1514
<   if (k2v["tracktype"] && isdigit (k2v["tracktype"][5])) {
<     s.aveSpeed[motorcarR] *= ('6' - k2v["tracktype"][5]) / 5.0;
<     // Alternatively use ... (6 - atoi (k2v["tracktype"] + 5)) / 5.0;
<     // TODO: Mooaar
---
>   if ((k2v["tracktype"] && isdigit (k2v["tracktype"][5])) ||
>     strcmp (k2v["highway"], "track") == 0) {
>     // many tracks don't have a tracktype, assume them as rather slow
>     int tracktype = 4;
>     if (k2v["tracktype"] && isdigit (k2v["tracktype"][5]))
>       tracktype = atoi (k2v["tracktype"] + 5);
>     s.aveSpeed[motorcarR] *= (6 - tracktype) / 5.0;
>     if (tracktype >= 3) s.aveSpeed[bicycleR] *= (6 - tracktype) / 4.0;
>     if (tracktype == 5) s.aveSpeed[footR] *= 0.8;
Last edited 6 years ago by travelling_salesman (previous) (diff)
Note: See TracTickets for help on using tickets.