What attribute affects 'Avoid Highways' on Garmin

I’ve built a map for my Garmin etrex using downloaded OSM data and mkgmap, and routing does work on it (I am using it for cycling).

The Garmin etrex has an ‘Avoid Highways’ feature and I would like to use this to avoid motorways, and major dual carriageways, but no more. However, it seems a bit too sensitive in what it considers a ‘highway’!
For instance I was following a route south on the A60 out from the centre of Nottingham (which isn’t a dual carriageway, is either 30mph or 40mph limit and I consider acceptable for cycling on). However, it kept trying to tell me to turn off the A60 at all costs, but as soon as I turned ‘Avoid Highways’ OFF, it routed me straight down the A60, which is what I wanted. However I want ‘Avoid Highways’ on in order to avoid Motorways.
So my intention is to edit (my downloaded copy of) the OSM data and recompile it so that it doesn’t consider roads like this as a ‘Highway’. I want to tag most roads that are currently ‘Highways’ as ‘non-Highways’, apart from motorways and major NSL trunk roads.

What attribute in the OSM data would I have to set in order to do this?


P.S., to avoid confusion, I’m not on about editing it on the server for everybody, I’m on about just editing my own copy of the raw OSM data after I’ve downloaded it, and I’m OK with editing the data once I know what attribute it is I have to change. So in other words if somebody can tell me how to do it for just one particular Way, then from that I should be able to do what I need.

The attribute that should be set on motorways on OSM is bicycle=no (but in most countries this is already default and mkgmap handles them this way).
It sounds like you have a new series Etrex, because the older ones respect the bicycle=no rule on OSM on motorways and the newest series don’t (unless you set carpool avoidance on).

Since you compile your own maps with mkgmap you better edit the default line style file, not the OSM database.
In this line style you either have to make the motorways and all roads forbidden for cycling non routable, or give them the highest road_class (=4).

May be this helps Rendering of MTB maps on Garmin units.

Ah, but I’m not using it in ‘bicycle’ routing mode, because I don’t want it to route me down cycle paths. (I use it in car mode - shortest distance).

I have got a new series etrex, yes.

If I put the following line in the ‘line’ style
highway=primary {highway=secondary}

would that have the effect of making all ‘primary’ highways ‘secondary’ ?

When you say “you better edit the default line style file, not the OSM database”, just to reiterate, I wasn’t thinking of editing the main database, just the xml that I have downloaded (Great_Britain.osm). But if it can be accomplished with a style rule then that’s probably better.

The only problem with a style rule is that I can’t see the result of what it’s done. As far as I see it it’s like a ‘preprocessor’ that runs before the compiler - is there any way of seeing the state as it is between the two? Or is there any way of opening up the gmapsupp.img (or browsing the attributes of the road on my Garmin) and seeing what the actual output road class of, say, the A60 is?

Thanks for the response.

On a related point, going slightly more advanced with my tweaking:
At the moment, I like ‘shortest’ as I don’t want to go a longer way round to go on, say a 60mph road, than a shorter way on a 40mph road.
But, if I have it on shortest, then say I’m going on a perfectly pleasant B-road that bypasses a village, then it might be tempted to route through the village with all its traffic lights, roundabouts etc, just because it is about 50 yards shorter. This I don’t want!
Now, if I wanted to set the ‘road speed’ to the same value for all roads, and chose ‘fastest’, then would that have the effect of choosing the shortest route but still take concentration of junctions into account as a slowing-down factor?

Ok, in that case it is important to know that bicycle tags from OSM have no effect on the routing.
This unit (and all other garmins with the latest routing activity firmware) only respect the road_class arguments that are defined in the line style: see http://wiki.openstreetmap.org/wiki/Mkgmap/help/style_rules#road_class and also avoidance options for unpaved roads, carpool lanes (Note: ways in osm tagged with access=no or motorcar=no!), toll roads (toll=yes), ferry still work as expected.

So motorways you can give an extra tag in your mkgmap style toll=yes to avoid them:

highway=motorway {add oneway = yes; add bicycle = no; add foot = no ; add toll=yes } [0x01 road_class=4 road_speed=7 resolution 16]

or just leave out the road_class=4 road_speed=7 parameters (beware this can have unwanted side effects on some units)

No, you need to use set:

highway=primary {set highway=secondary}

With gpsmapedit you can edit the individual img tiles (not sure if it can read gmapsupp.img) and see what the result is.

As far as I know it doesnt care about junctions so it will take the shortest way through the town unfortunately.
Only roundabouts have a lower road_speed so the routing will only take them into account.
I dont know how or or if you can use traffic lights pois into account to influence routing.

GPSmapedit will open gmapsupp.img files, but it complains less with single IMG tiles. It’s primarily a cgpsmapper tool though. Will it show routing attributes from mkgmap?

ok - so are you saying that in determining what is a “Highway” it only uses the road_class, and not the “highway=***” argument?
If so, what is the minimum road_class is defined as a “Highway” / maximum road_class that isn’t defined as a “Highway”?

Yes, I thought of that. There are some tolls I don’t want to avoid, but I can probably deal with that if that’s the only consequence and I can’t get it to work using road_class or highway.

ok, I nearly got it :wink: …but would that achieve the desired result, given what you say about it only respecting road_class?

In other words, if i want to modify the set of roads that it avoids when using ‘Avoid Highways’ on the garmin, should I modify the ‘road_class=’ argument, or the 'highway=’ argument?
(and what to?)

Thanks for the detailed responses by the way, much appreciated.

@seldom: yes you can see the road_class and road_speed attributes, and also access tags.

Yes, for my bike maps I use road_class=4 and 3 for the cycleways, so they become the main highways.
Unfortunately, avoiding “highways” doesnt always avoid them so I’m not sure if road_class will always work.
You better can make them not routable so the Garmin will never take them.

Maybe, you have to experiment a bit. I dont know how the etrex will respond.

road_class=4 are the major highways. With road_class=0 you can avoid residential roads (in Basecamp, dont know if that option is available on your Etrex).
Garmin doesnt understand something like highway=motorway, cycleway or primary or whatever.

If you want to “misuse” the toll road option, you can ‘reset’ the toll=yes roads (some of them you dont want to avoid) first:

highway=* & toll=yes {delete toll}

highway=motorway {set toll=yes}

And of course you can use toll=yes also for all other highways that are not accessible for cycling (or where you definitely dont want to cycle), just by adding the arrgument toll=yes to bicycle=no:

highway=* & bicycle=no {set toll=yes}
highway=footway {set toll=yes}

hmm… I tried this last night.
Only slight issue:
it refused to route over this toll bridge, even when avoid tolls was ‘off’ and/or when I’d removed the ‘toll’ attribute using the “highway=* & toll=yes {delete toll}” line.
I think (hope) this is because as well as the toll bridge, it has got two nodes with “barrier=toll_booth”, one on each side of the road, just east of the bridge, and I presume the garmin is just point blankly assuming anything with “barrier=*” it can’t go past. I’ll try putting “barrier=toll_booth {delete barrier}” in the points file.

Another slight issue I wonder if there’s any rememdy you know about: it navigated absolutely perfectly last night apart from one ‘phantom’ right turn, about here: http://www.openstreetmap.org/?lat=52.937569&lon=-1.06468&zoom=18&layers=M
Going ENE on the A52, the correct route was to carry on going ENE on the A52. However the instruction was ‘right on Stragglethorpe lane’ (the minor road heading off SSE), although the turn arrow appeared to show doing a U-turn straight away, and turning right again back onto the A52. I presume this is because the lane extends right across both lanes of the A52 and its ‘node’ is included in the route, so it features as part of the route. To be fair I was actually on the cycle path (although using ‘car’ routing) shown as a dotted blue line to the left (north) of the eastbound lane of the A52 - would not being quite on the road have had an impact?

If you zoom in, you can see this toll bridge is only accessible from the west (east bound one way traffic only): http://www.openstreetmap.org/?way=35580773
The south fork lane on the eastern side of the bridge doesn’t reach the toll bridge at all. I think it is a mapping error.

The second case I dont understand, do you have your navigation set on lock to road? Better dont do that.

Ah yes you’re right!
I edited it to join up with http://www.openstreetmap.org/browse/node/128162540
instead, does that look ok?

Yes, it looks correct now.

About your second case, I see that you can’t get to Stragglethorpe Lane (southbound) from the cycleway because the junction is not correctly drawn.
The Sandy Lane track http://www.openstreetmap.org/browse/way/143577746 doesnt connect with the Stragglethorpe Lane (it ends on the north lane of a oneway trunk road, so you cant get from the track onto the tertiary road). Maybe this could be the reason why your Garmin got confused?

Is there a way of applying the changeset to existing downloaded data?
Even if the place I downloaded it from updates itself to reflect my edit (unlike say for example www.openrouteservice.org ?) then I would have to download the whole Great_Britain.osm again.

I dont know anything about applying a changeset, but for downloading a small area you can try the export tab in osm.org: