Re: [mkgmap-dev] problem with highway=cycleway in default style

2011-07-06 Thread Marko Mäkelä
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
___
mkgmap-dev mailing list
mkgmap-dev@lists.mkgmap.org.uk
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev


Re: [mkgmap-dev] problem with highway=cycleway in default style

2011-07-06 Thread Ben Konrath
Hi Marko / everybody,

On Wed, Jul 6, 2011 at 1:18 PM, Ben Konrath b...@bagu.org wrote:
[snip]
 On Wed, Jul 6, 2011 at 9:15 AM, Marko Mäkelä marko.mak...@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
diff --git a/src/uk/me/parabola/mkgmap/reader/osm/HighwayHooks.java b/src/uk/me/parabola/mkgmap/reader/osm/HighwayHooks.java
index 8627f26..9859807 100644
--- a/src/uk/me/parabola/mkgmap/reader/osm/HighwayHooks.java
+++ b/src/uk/me/parabola/mkgmap/reader/osm/HighwayHooks.java
@@ -167,6 +167,14 @@ public class HighwayHooks extends OsmReadingHooksAdaptor {
 	}
 
 	public void onAddWay(Way way) {
+		// always ignore 'access = yes' because no access tag has this meaning
+		// see this thread for more info:
+		// http://www.mkgmap.org.uk/pipermail/mkgmap-dev/2011q3/011884.html
+		String access = way.getTag(access);
+		if (access != null  yes.equals(access)) {
+			way.deleteTag(access);
+		}
+
 		String highway = way.getTag(highway);
 		if (highway != null || ferry.equals(way.getTag(route))) {
 			boolean oneway = way.isBoolTag(oneway);
___
mkgmap-dev mailing list
mkgmap-dev@lists.mkgmap.org.uk
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev

Re: [mkgmap-dev] problem with highway=cycleway in default style

2011-07-06 Thread Ben Konrath
On Wed, Jul 6, 2011 at 3:31 PM, Marko Mäkelä marko.mak...@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
___
mkgmap-dev mailing list
mkgmap-dev@lists.mkgmap.org.uk
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev

Re: [mkgmap-dev] problem with highway=cycleway in default style

2011-07-05 Thread Felix Hartmann



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.276167lon=-113.804459zoom=18layers=MOn

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
___
mkgmap-dev mailing list
mkgmap-dev@lists.mkgmap.org.uk
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev

Re: [mkgmap-dev] problem with highway=cycleway in default style

2011-07-05 Thread Ben Konrath
HI Felix,

On Tue, Jul 5, 2011 at 12:37 PM, Felix Hartmann extremecar...@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
diff --git a/resources/styles/default/lines b/resources/styles/default/lines
index b335c7b..802dd7b 100644
--- a/resources/styles/default/lines
+++ b/resources/styles/default/lines
@@ -119,7 +119,7 @@ highway=service  (service=alley|service=driveway)
 [0x07 road_class=0 road_speed=0 resolution 23]
 highway=service [0x07 road_class=0 road_speed=2 resolution 22]
 
-highway=cycleway {add access = no; add bicycle = yes; add foot = yes} [0x07 road_class=0 road_speed=1 resolution 23]
+highway=cycleway {set access = no; add bicycle = yes; add foot = yes} [0x16 road_class=0 road_speed=1 resolution 23]
 
 highway=footway|highway=path|highway=steps {add access = no; add foot = yes} [0x16 road_class=0 road_speed=0 resolution 23]
 highway=track [0x0a road_class=0 road_speed=1 resolution 22]
___
mkgmap-dev mailing list
mkgmap-dev@lists.mkgmap.org.uk
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev

Re: [mkgmap-dev] problem with highway=cycleway in default style

2011-07-05 Thread Felix Hartmann


On 05.07.2011 12:51, Ben Konrath wrote:
 HI Felix,

 On Tue, Jul 5, 2011 at 12:37 PM, Felix Hartmannextremecar...@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)
___
mkgmap-dev mailing list
mkgmap-dev@lists.mkgmap.org.uk
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev


Re: [mkgmap-dev] problem with highway=cycleway in default style

2011-07-05 Thread Ben Konrath
On Tue, Jul 5, 2011 at 1:04 PM, Felix Hartmann extremecar...@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
___
mkgmap-dev mailing list
mkgmap-dev@lists.mkgmap.org.uk
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev