problem with highway=cycleway in default style

Hi everybody, I've found a problem with the highway=cycleway in the default style. The current setting from the default lines file is this: highway=cycleway {add access = no; add bicycle = yes; add foot = yes} [0x07 road_class=0 road_speed=1 resolution 23] One small problem is that the cycleway should probably be listed as a path or trail (0x16) instead of alley (0x07). The bigger issue, however, is that the extra tags which are added to highway=cycleway makes cycleways routable by car under certain circumstances. The problem comes from the way that the access tag is used in the style file. The access tag in OSM describes legal access to a given highway: http://wiki.openstreetmap.org/wiki/Key:access A tag with 'access = no' means that the general public is not allowed to go on that particular highway. Likewise, 'access = yes' means that the general public is allowed to use that highway. And then there's specific types of access in between yes and no for specific types of traffic as listed on tag's wiki page. In the default style of mkgmap, it seems that the access tag is used to represent whether or not a particular highway type is routable by motor vehicle. If you have have cycyleway that is tagged with 'access = yes' - meaning the public is allowed use that cycleway - the 'add access = no' rule will not overwrite the access rule in the OSM data and the cycleway will be routable by motor vehicle. An example of this can be found in Red Deer, Alberta, Canada on the Bob Johnson Trail: http://www.openstreetmap.org/?lat=52.276167&lon=-113.804459&zoom=18&layers=M... To solve this problem, I've changed 'add access = no' to 'set access = no' so that the access tag will be overwritten and cycleways will not be routable. But this seems to be a hack because it's not really describing the OSM data correctly. I think it would be better to use the motor_vehicle tag to determine if a cycleway is routable by car. The motor_vehicle tag is described on the 'access' tag's osm wiki page above. Here's the proposed style for cycleways: highway=cycleway {add motor_vehicle = no; set bicycle = yes; add foot = yes} [0x16 road_class=0 road_speed=1 resolution 23] This would prohibit motor_vehicle routing on cycleways by default if the cycleway if the cycleway doesn't have a motor_vehicle tag. This would also allow motor vehicle routing on cycleways that allow it as described in this thread from last month: http://www.mkgmap.org.uk/pipermail/mkgmap-dev/2011q2/011771.html We'd still have to support the OSM access tag somehow. I did a quick grep through the mkgmap source and it seems that there isn't support of the motor_vehicle tag. I would like to make a patch to address this issue but I have a couple of questions first. Is the access tag used to describe motor vehicle access in mkgmap? Does the garmin format support the idea of public / private access separately from motor vehicle access? For now, I'm using the attached patch prohibit . I've change 'add bicycle = yes' to 'set bicycle = yes' because anything tagged a cycleway must allow bicycles by definition. Thanks, Ben

On 05.07.2011 12:34, Ben Konrath wrote:
Hi everybody,
I've found a problem with the highway=cycleway in the default style. The current setting from the default lines file is this:
highway=cycleway {add access = no; add bicycle = yes; add foot = yes} [0x07 road_class=0 road_speed=1 resolution 23]
One small problem is that the cycleway should probably be listed as a path or trail (0x16) instead of alley (0x07).
The bigger issue, however, is that the extra tags which are added to highway=cycleway makes cycleways routable by car under certain circumstances. The problem comes from the way that the access tag is used in the style file. The access tag in OSM describes legal access to a given highway:
http://wiki.openstreetmap.org/wiki/Key:access
A tag with 'access = no' means that the general public is not allowed to go on that particular highway. Likewise, 'access = yes' means that the general public is allowed to use that highway. And then there's specific types of access in between yes and no for specific types of traffic as listed on tag's wiki page.
In the default style of mkgmap, it seems that the access tag is used to represent whether or not a particular highway type is routable by motor vehicle. If you have have cycyleway that is tagged with 'access = yes' - meaning the public is allowed use that cycleway - the 'add access = no' rule will not overwrite the access rule in the OSM data and the cycleway will be routable by motor vehicle. An example of this can be found in Red Deer, Alberta, Canada on the Bob Johnson Trail:
http://www.openstreetmap.org/?lat=52.276167&lon=-113.804459&zoom=18&layers=M...
To solve this problem, I've changed 'add access = no' to 'set access = no' so that the access tag will be overwritten and cycleways will not be routable. But this seems to be a hack because it's not really describing the OSM data correctly. I think it would be better to use the motor_vehicle tag to determine if a cycleway is routable by car. The motor_vehicle tag is described on the 'access' tag's osm wiki page above. Here's the proposed style for cycleways:
highway=cycleway {add motor_vehicle = no; set bicycle = yes; add foot = yes} [0x16 road_class=0 road_speed=1 resolution 23] That wouldn't change anything. 0x16 is routable by motorcars too. Add is correct, as in some places people seem to think that cycleways are usable for cars (for short distances and so on). Else use set access=no; set bicycle=yes; add foot=yes.
This would prohibit motor_vehicle routing on cycleways by default if the cycleway if the cycleway doesn't have a motor_vehicle tag. This would also allow motor vehicle routing on cycleways that allow it as described in this thread from last month:
http://www.mkgmap.org.uk/pipermail/mkgmap-dev/2011q2/011771.html
We'd still have to support the OSM access tag somehow. I did a quick grep through the mkgmap source and it seems that there isn't support of the motor_vehicle tag. I would like to make a patch to address this issue but I have a couple of questions first. Is the access tag used to describe motor vehicle access in mkgmap? Does the garmin format support the idea of public / private access separately from motor vehicle access?
For now, I'm using the attached patch prohibit . I've change 'add bicycle = yes' to 'set bicycle = yes' because anything tagged a cycleway must allow bicycles by definition.
Thanks, Ben
_______________________________________________ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev

HI Felix, On Tue, Jul 5, 2011 at 12:37 PM, Felix Hartmann <extremecarver@gmail.com> wrote: [snip]
highway=cycleway {add motor_vehicle = no; set bicycle = yes; add foot = yes} [0x16 road_class=0 road_speed=1 resolution 23]
That wouldn't change anything. 0x16 is routable by motorcars too. Add is correct, as in some places people seem to think that cycleways are usable for cars (for short distances and so on). Else use set access=no; set bicycle=yes; add foot=yes.
According to the OSM tag rules, if a cycleway is allowed to used by cars, the motor_vehicle should be set to yes in which case the 'add motor_vehicle = no' wouldn't do anything which is correct. Let me try to clarify things a bit. The OSM data separates who's allowed to access a given way and what type of traffic is allowed on a given way. I think that mkgmap should properly support this. The garmin format may not support these distinctions in which case we'll need to tweak the style file to combine them as best as we can. There are problems with the way that is currently being done in the default style of mkgmap. By the way, 'set bicycle = yes' is actually wrong in the patch that I attached because it could overwrite other information in the bicycle tag. I've attached a corrected patch which keeps the 'add bicycle = yes'. Cheers, Ben

On 05.07.2011 12:51, Ben Konrath wrote:
HI Felix,
On Tue, Jul 5, 2011 at 12:37 PM, Felix Hartmann<extremecarver@gmail.com> wrote: [snip]
highway=cycleway {add motor_vehicle = no; set bicycle = yes; add foot = yes} [0x16 road_class=0 road_speed=1 resolution 23]
That wouldn't change anything. 0x16 is routable by motorcars too. Add is correct, as in some places people seem to think that cycleways are usable for cars (for short distances and so on). Else use set access=no; set bicycle=yes; add foot=yes. According to the OSM tag rules, if a cycleway is allowed to used by cars, the motor_vehicle should be set to yes in which case the 'add motor_vehicle = no' wouldn't do anything which is correct.
Let me try to clarify things a bit. The OSM data separates who's allowed to access a given way and what type of traffic is allowed on a given way. I think that mkgmap should properly support this. The garmin format may not support these distinctions in which case we'll need to tweak the style file to combine them as best as we can. There are problems with the way that is currently being done in the default style of mkgmap.
By the way, 'set bicycle = yes' is actually wrong in the patch that I attached because it could overwrite other information in the bicycle tag. I've attached a corrected patch which keeps the 'add bicycle = yes'.
Cheers, Ben But there is no difference in routing between 0x07 and 0x16! (else my maps wouldn't work...)
There are only very few types that have very special attributes and they only differ in the routing instructions but not the access rights like the ones for junctions and roundabouts (well and then there are the ferry types that are super special)

On Tue, Jul 5, 2011 at 1:04 PM, Felix Hartmann <extremecarver@gmail.com> wrote: [snip]
But there is no difference in routing between 0x07 and 0x16! (else my maps wouldn't work...)
There are only very few types that have very special attributes and they only differ in the routing instructions but not the access rights like the ones for junctions and roundabouts (well and then there are the ferry types that are super special)
Ah ok, I understand what you were getting at now. Changing 0x07 to 0x16 make my GPS draw a trail or path, not an alley. With 0x07, hovering above the way pops up 'Alley' while 0x16 pops up the path name. I just think 0x16 is more correct for cycleway. Ben

Hi Ben, On Tue, Jul 05, 2011 at 12:34:20PM +0200, Ben Konrath wrote:
I've found a problem with the highway=cycleway in the default style. The current setting from the default lines file is this:
highway=cycleway {add access = no; add bicycle = yes; add foot = yes} [0x07 road_class=0 road_speed=1 resolution 23]
One small problem is that the cycleway should probably be listed as a path or trail (0x16) instead of alley (0x07).
I changed this some months ago. The idea was to distinguish 'proper' cycleways from footways or forest paths that are not necessarily useable by all types of bicycles. All these used to be 0x16.
The bigger issue, however, is that the extra tags which are added to highway=cycleway makes cycleways routable by car under certain circumstances. The problem comes from the way that the access tag is used in the style file.
There have been examples where Garmin routing will use a way that is prohibited from motor vehicles, for the last leg of the route. Like someone pointed out recently, their idea could have been that you would exit the vehicle and have walking directions to the destination.
The access tag in OSM describes legal access to a given highway:
http://wiki.openstreetmap.org/wiki/Key:access
A tag with 'access = no' means that the general public is not allowed to go on that particular highway. Likewise, 'access = yes' means that the general public is allowed to use that highway. And then there's specific types of access in between yes and no for specific types of traffic as listed on tag's wiki page.
In the default style of mkgmap, it seems that the access tag is used to represent whether or not a particular highway type is routable by motor vehicle.
I have not looked at this code recently, so my understanding may be wrong. My interpretation (and understanding of mkgmap's interpretation) of the access tags is that access=* gives the 'default' rights of using the way and it can be overridden by more specific tags. For example, a cycleway that also doubles as a driveway to some properties next to a highway=secondary could be tagged highway=path, access=destination, foot=designated, bicycle=designated, segregated=no. Similarly, a highway=residential that is not allowed for through traffic by motor vehicles, could be tagged access=destination, foot=yes, bicycle=yes.
If you have have cycyleway that is tagged with 'access = yes' - meaning the public is allowed use that cycleway - the 'add access = no' rule will not overwrite the access rule in the OSM data and the cycleway will be routable by motor vehicle.
Isn't it a bit redundant to add access=yes to ways? Usually, you would add access restrictions. I would say that this is a problem in the map data.
I think it would be better to use the motor_vehicle tag to determine if a cycleway is routable by car.
To my understanding, mkgmap does not observe the motor_vehicle tag at all. It obeys motorcar and motorcycle. I do not know what happens if they contradict. As far as I understand, the Garmin map format cannot distinguish motorcar and motorcycle. Is it correct to use motor_vehicle instead of the more specific motorcar or motorcycle? A snowmobile is also a motor vehicle, but (depending on legislation) snowmobiles are not necessarily allowed on ways that are allowed for cars and motorcycles. Come to think of it, for simplicity access=* should probably cover 'normal' vehicles. Motorized terrain vehicles should rely on specific tags, such as snowmobile=yes.
We'd still have to support the OSM access tag somehow. I did a quick grep through the mkgmap source and it seems that there isn't support of the motor_vehicle tag. I would like to make a patch to address this issue but I have a couple of questions first. Is the access tag used to describe motor vehicle access in mkgmap? Does the garmin format support the idea of public / private access separately from motor vehicle access?
My understanding is that Garmin supports a few modes of transportation: foot, bicycle, motorcycle/motorcar, emergency, and possibly some others. Each mode has access bits, something like yes/destination/no. Best regards, Marko

Hi Marko, Thanks for the explanation of things. Let me reply inline to some specific comments. On Wed, Jul 6, 2011 at 9:15 AM, Marko Mäkelä <marko.makela@iki.fi> wrote: [snip]
If you have have cycyleway that is tagged with 'access = yes' - meaning the public is allowed use that cycleway - the 'add access = no' rule will not overwrite the access rule in the OSM data and the cycleway will be routable by motor vehicle.
Isn't it a bit redundant to add access=yes to ways? Usually, you would add access restrictions. I would say that this is a problem in the map data.
This is a good point. Looking at the taginfo: http://taginfo.openstreetmap.org/keys/?key=access#values 'access = yes' is definitely being and it seems to be a valid tag/value pair according the wiki. I think it would be a good idea to remove the 'access = yes' from the OSM data. Perhaps we could remove this tag/value pair when mkgmap is reading in the data? That way all of the ways will be "normalized" to mean 'access = yes' if no access tag is present. And then we could keep 'add access = no' for the cycleways which would give the correct behaviour. I can see that my 'set access = no' with overwrite other types of access like 'access = destination' so it's not a good way forward. Thoughts? I'd be happy to make the patch.
I think it would be better to use the motor_vehicle tag to determine if a cycleway is routable by car.
To my understanding, mkgmap does not observe the motor_vehicle tag at all. It obeys motorcar and motorcycle. I do not know what happens if they contradict. As far as I understand, the Garmin map format cannot distinguish motorcar and motorcycle.
Is it correct to use motor_vehicle instead of the more specific motorcar or motorcycle? A snowmobile is also a motor vehicle, but (depending on legislation) snowmobiles are not necessarily allowed on ways that are allowed for cars and motorcycles.
The more specific motorized vehicle tag (e.g. snowmobile) takes precedence. I guess the moter_vehicle tag is mostly useful for indicating that all motorize vehicle traffic is prohibited on a given way.
Come to think of it, for simplicity access=* should probably cover 'normal' vehicles. Motorized terrain vehicles should rely on specific tags, such as snowmobile=yes.
That sounds reasonable.
We'd still have to support the OSM access tag somehow. I did a quick grep through the mkgmap source and it seems that there isn't support of the motor_vehicle tag. I would like to make a patch to address this issue but I have a couple of questions first. Is the access tag used to describe motor vehicle access in mkgmap? Does the garmin format support the idea of public / private access separately from motor vehicle access?
My understanding is that Garmin supports a few modes of transportation: foot, bicycle, motorcycle/motorcar, emergency, and possibly some others. Each mode has access bits, something like yes/destination/no.
Good to know. Thanks, Ben

Hi Marko / everybody, On Wed, Jul 6, 2011 at 1:18 PM, Ben Konrath <ben@bagu.org> wrote: [snip]
On Wed, Jul 6, 2011 at 9:15 AM, Marko Mäkelä <marko.makela@iki.fi> wrote: [snip]
Isn't it a bit redundant to add access=yes to ways? Usually, you would add access restrictions. I would say that this is a problem in the map data.
This is a good point. Looking at the taginfo:
http://taginfo.openstreetmap.org/keys/?key=access#values
'access = yes' is definitely being and it seems to be a valid tag/value pair according the wiki. I think it would be a good idea to remove the 'access = yes' from the OSM data. Perhaps we could remove this tag/value pair when mkgmap is reading in the data? That way all of the ways will be "normalized" to mean 'access = yes' if no access tag is present. And then we could keep 'add access = no' for the cycleways which would give the correct behaviour. I can see that my 'set access = no' with overwrite other types of access like 'access = destination' so it's not a good way forward. Thoughts? I'd be happy to make the patch.
A proposed patch to solve this issue is attached. Comments are appreciated. Thanks, Ben

On Wed, Jul 06, 2011 at 02:52:59PM +0200, Ben Konrath wrote:
'access = yes' is definitely being and it seems to be a valid tag/value pair according the wiki. I think it would be a good idea to remove the 'access = yes' from the OSM data. Perhaps we could remove this tag/value pair when mkgmap is reading in the data? That way all of the ways will be "normalized" to mean 'access = yes' if no access tag is present. And then we could keep 'add access = no' for the cycleways which would give the correct behaviour.
With this scheme, we would still get the proper behaviour with cycleways that have been tagged as access=destination (implying motor vehicle routing).
I can see that my 'set access = no' with overwrite other types of access like 'access = destination' so it's not a good way forward. Thoughts?
Would something like this work at the top of the style file? highway=* & access = yes { delete access } I would prefer to do such tweaks in the style language, if possible. For example, the --make-opposite-cycleways (or whatever it is called) would be easier to understand and maintain if it made use of the continue_with_actions that was introduced after the feature was implemented. It could be a good idea to treat motor_vehicle the same as motorcar and motorcycle, and warn if there is a conflict (such as motorcar=yes, motorcycle=no). Best regards, Marko

On Wed, Jul 6, 2011 at 3:31 PM, Marko Mäkelä <marko.makela@iki.fi> wrote:
On Wed, Jul 06, 2011 at 02:52:59PM +0200, Ben Konrath wrote:
'access = yes' is definitely being and it seems to be a valid tag/value pair according the wiki. I think it would be a good idea to remove the 'access = yes' from the OSM data. Perhaps we could remove this tag/value pair when mkgmap is reading in the data? That way all of the ways will be "normalized" to mean 'access = yes' if no access tag is present. And then we could keep 'add access = no' for the cycleways which would give the correct behaviour.
With this scheme, we would still get the proper behaviour with cycleways that have been tagged as access=destination (implying motor vehicle routing).
Yep.
I can see that my 'set access = no' with overwrite other types of access like 'access = destination' so it's not a good way forward. Thoughts?
Would something like this work at the top of the style file?
highway=* & access = yes { delete access }
I didn't know you could that with the style rules. I just tried this but it actually removed the whole way in the resulting map. Maybe there's a bug in mkgmap with this type of rule??
I would prefer to do such tweaks in the style language, if possible. For example, the --make-opposite-cycleways (or whatever it is called) would be easier to understand and maintain if it made use of the continue_with_actions that was introduced after the feature was implemented.
Yeah, I agree. Using the style rules for things like this makes it more maintainable.
It could be a good idea to treat motor_vehicle the same as motorcar and motorcycle, and warn if there is a conflict (such as motorcar=yes, motorcycle=no).
That seems good. Do you know how to represent that in the style file? Thanks, Ben

Hi Marko, On Wed, Jul 6, 2011 at 8:02 PM, Ben Konrath <ben@bagu.org> wrote:
On Wed, Jul 6, 2011 at 3:31 PM, Marko Mäkelä <marko.makela@iki.fi> wrote: [snip]
Would something like this work at the top of the style file?
highway=* & access = yes { delete access }
I didn't know you could that with the style rules. I just tried this but it actually removed the whole way in the resulting map. Maybe there's a bug in mkgmap with this type of rule??
Sorry, it's actually working. I had just updated my unit software and I was viewing the built in maps instead of the OSM maps. I think that rule is good to commit. :-) Sorry again for the noise. Ben

On Wed, Jul 06, 2011 at 08:02:23PM +0200, Ben Konrath wrote:
It could be a good idea to treat motor_vehicle the same as motorcar and motorcycle, and warn if there is a conflict (such as motorcar=yes, motorcycle=no).
That seems good. Do you know how to represent that in the style file?
To my knowledge, style actions cannot emit warnings. There is an 'echo' action, but it is mostly for debugging style rules, I guess. This would have to be done in the Java code. If the 'delete access' action works for you now, I will test it for tomorrow's map build and commit it then. Best regards, Marko

On Wed, Jul 6, 2011 at 10:19 PM, Marko Mäkelä <marko.makela@iki.fi> wrote:
On Wed, Jul 06, 2011 at 08:02:23PM +0200, Ben Konrath wrote:
It could be a good idea to treat motor_vehicle the same as motorcar and motorcycle, and warn if there is a conflict (such as motorcar=yes, motorcycle=no).
That seems good. Do you know how to represent that in the style file?
To my knowledge, style actions cannot emit warnings. There is an 'echo' action, but it is mostly for debugging style rules, I guess. This would have to be done in the Java code.
The 'delete access' action solves the problem that I was having so I'm ok with leaving the motor_vehicle tag as it's handled now (ignored). If we find a specific issue in the future, we can continue this discussion. Thanks for your help! :-) Cheers, Ben
participants (3)
-
Ben Konrath
-
Felix Hartmann
-
Marko Mäkelä