Displaying a relation on top of OSM map features

Has anyone had success with displaying one mapset over another with different display characteristics for the same features?
I have a relation of a long distance path saved as a .osm file in JOSM and processed, using mkgmap and incorporating a .TYP file, to a gmapsupp.img whose filename I have renamed. Additionally, I have OSM data of the British Isles processed, using mkgmap and incorporating the same .TYP file, to gmapsupp.img.
My aim is to display the relation as a dotted or dashed line over the same ways and highways that are in the British Isles mapsets in their own styles.
Loading both to my Legend HCx, the British Isles map data displays properly, with the styles in the .TYP file. The relation does not display at all, although the mapset is present, even when the British Isles mapsets are hidden.
I have tried processing the relation with its own .TYP file. In this case, the relation appears in its own style, but the British Isles map data displays in the default style.
Is it not possible to achieve what I am attempting to do?

I think it would be better to put the osm data together. With combining the gmapsupp.img, you cannot predict which line is drawn first, and which last inside the unit.

To render hiking relations, I have made my own style. Written in German, but you see the rendering:
http://wiki.openstreetmap.org/wiki/User:Ajoessen/myTopo

(Heavily inspired by ligfietsers map)

Using overlay may solve your problem also.

HTH,
ajoessen

Yes, works fine for me with my maps. I have different mapsets for contour lines, hiking ways and bicycling (http://osm.thkukuk.de).

There are some very simple rules:

  • All images in all maps needs to have different numbers
  • The IDs of the TYP files have to be different or the TYP files needs to be exactly the same
  • The relation layer needs a higher drawing order and needs to be transparent

Thorsten

ajoessen,
I have combined the .osm of the relation with the one particular .osm.gz of the OSM map data that covers the same area from the 29 .osm.gz files that mkgmap splitter created to cover British Isles. The resulting gmapsupp.img loads as two mapsets. With the OSM map data hidden, the relation displays with the very same styles, not with its own style.
I should be grateful if you would explain how to use ‘overlay’ with a relation.

Thorsten,
I, too, have different mapsets for contour lines and British National Grid on top of my OSM map data. What I seek to do is different: I want the relation to show as, for example, a thick pink dotted or dashed line over a grey track, green dashed footpath and orange road where its ways are identical and, therefore, coincident with them. In this way, I should see the relation without totally obscuring the underlying OSM map data.
I use one .TYP file that includes and specifies a different Garmin code for the relation from the OSM map data. I use a higher draw priority for the relation than the OSM map data.

I thank you both for your efforts to help me.

Bob

You need to enter code in both relations and lines, ie

in relations

type=route & (route=foot|route=hiking){ apply { add my_route1=yes;add route=foot; add route_name_foot = ‘${name}’; add ref = ‘${ref}’ } }

in lines

highway=* & (route=hiking | route=foot ) {name ‘${ref|highway-symbol:oval} ${name}’ | ‘${ref|highway-symbol:oval}’ | ‘${name}’ }

(only works if your route has a ref)

my_route1=yes [0x10605 resolution 20 ]

I use TYPWiz2 to create the 10605+ lines with bitmap height 15, a solid colour & transparancy.

you can define as many routes as you like

wilpin,
I thank you for your reply.
Part of my difficulty is that I do not fully understand the syntaxes that are used in the mkgmap styles files and certainly could not create any but the simplest.
Therefore, I replaced the code kindly provided to me by ‘SomeoneElse’ on the mkgmap-dev list with your own in the lines and relations files. The only change I made was to simply substitute your 0x10605 code with my 0x28 in the lines file, which is in my master .TYP file already as a thick dashed purple line.
The result is the same: the relation imitates the style of the OSM map data and does not display its own style. The only difference to previously is that the ref, in this case ‘CW’ for The Chiltern Way, appears alongside the highways and ways.
Bob

Where is the draw order of lines defined? I only know a draw order for polygons inside the TYP file.

Greetings,
ajoessen

as ajoessen says there is no draworder of lines and also unfortunately as with bridges the ‘order’ seems to depend on your gps device.

‘I have tried processing the relation with its own .TYP file. In this case, the relation appears in its own style, but the British Isles map data displays in the default style.’

Yes,that makes sense:

You can only have one! TYP file for each map/img so route has to be included in the same typ file, not two !

I suspect your route does not show properly because

a) your route line isn’t wide enough and therefore may lie below the other highways
b) you are using lines types <&100 to display routes ; mkgmap uses extended types, ie 0x>100 for bridges and routes
c) you are using the same type number for a route and a highway.

The overlay style file is explained here:
http://www.cferrero.net/maps/mkgmap_tiddlywiki.html#overlaysStyleFile
Maybe csdf can tell a bit more about it. This feature is not used very often.

You can take my style file zip from here:
http://bahnradwandern.bplaced.net/myTopo.zip
and have a closer look.

The relations are processed in the “relation” file. Every way used by the relation gets some additional tags there. These tags are afterwards processed within the “lines” file.

In the “lines” file, a special Garmin typ code is given for some roads, which is not defined in the TYP file.
In the “overlay” file, this extra Garmin typ code is defined by two other type codes, which are defined in the TYP file.
For instance, the first is the normal highway typ, and the second for the route rendering.

I dont know exactly why, but these two line types are rendered in the order given in the overlay file. But only on the Garmin unit, not in Mapsource, BaseCamp or QlandkarteGT.

HTH,
ajoessen

Actually Silver Surfer emailed me directly about this and I’m sorry to say I haven’t had a chance to reply. I don’t bother with relations so I’m not sure if there’s any special treatment for them, but my tactic would be to make sure that the relation was in the same OSM file as the base data and just treat it separately via the style file and TYP.

I think Thorsten means the draw-priority in the mgkmap options. If you give the osm basemap --draw-priority=20 and the mapset with your hiking relation layer draw-priority=21 this map will always show on top. You also need to give both mapsets different family ID’s in order to use different TYP files.

Another way of showing route relations on top in the same mapset is using the continue statement in the line rules.
I’d recommend to use type 0x01 for the hiking routes in combination with continue rules, because this line type always show on top of other lines.
It has a few consequences:

-You have to substitute motorways (0x01) to another routable line type, I’d suggest to combine it with trunk roads 0x02
-The hiking route line must be routable too, otherwise routing will break when searching for an address

If i take Wilpins example, you have to define the hiking route relation rule in the relation style file and add this rule at the beginning of your lines file:

my_route1=yes [0x01 road_class=0 road_speed=0 resolution 20 continue with_actions ]

under this you can copy the default line styles (with motorways moved to 0x02)

The fact that you will get two routable lines on top of each other may get routing issues but in my maps I havent found any, nor the users of my cycling maps.
If you are not confident about this, better use two separate mapsets.

ligfietser,
I thank you for your contribution. I am making progress! However, I am not quite there, yet…
I placed 'my_route1=yes [0x01 road_class=0 road_speed=0 resolution 20 continue with_actions ] ’ towards the beginning of the lines file (previously, I had the similar line from wilpin at the end). The ‘continue with_actions’ proved necessary in order to display coincident detail.
Initially, I simply used 0x01 to determine that the process worked. It did. Next, I substituted 0x01 with my own 0x28. That worked, too!
Now for the final part that does not yet work:
I am using two files for testing: Relation_23309.osm and 63240017.osm.gz. The Relation file happens to be more up-to-date than the OSM map data. I can see from the result that more hiking routes than Relation 23309 display. At the same time, I can see that Relation_23309.osm is used, because parts of its route that I added later than the currency of the OSM data display, also.
I was advised by user ‘SomeoneElse’ that I could select The Chiltern Way alone for display by the use of add ref = ‘CW’ in the relations file. This is what seems not to work: it appears to add the ref to other hiking routes, also, which continue to display.
This is the line I have in my Relations file, as given by wilpin: type=route & (route=foot|route=hiking){ apply { add my_route1=yes;add route=foot; add route_name_foot = ‘${name}’; add ref = ‘${ref}’ } }.
I should be grateful if someone could provide a similar line that will single out The Chiltern Way relation 23309 (ref=CW) for display only.

Bob

Maybe SomeoneElse meant include ref=‘CW’ in the relations file in the sense of “&”

type=route & ref=‘CW’ & (route=foot|route=hiking) etc will show ONLY the hiking routes with ref ‘CW’

if you put add ref=‘CW’ between the apply brackets this means that mkgmap will add the tag ref=CW on ALL hiking relations and that is not what you want, of course.

ligfietser
Success!
I thank you all for getting me to the solution.

Bob

I wish to relate what I have discovered in the course of learning how to work with relations in case it is of use to anyone:
Loading my processed British National Grid (BNG) as gmapsupp2.img together with my OSM map data as gmapsupp.img to my Legend HCx using sendmap, both have always displayed. The BNG displayed according to my .TYP style using Garmin’s political boundaries’ line codes 0x1c, 0x1d and 0x1e.
When I wished to use the political boundaries’ codes for political boundaries, user Roger Calvert (who created GreatBritain-grid.osm) suggested I could use Garmin’s marine code 0x103, subtypes 0x00, 0x01 and 0x02 for BNG instead. Two things occurred: 1) the line styles in my .TYP file were not recognised although I had changed the Garmin line codes and 2) BNG would only display if it was loaded alone but not with the OSM map data.
However, what I did discover when learning how to work with the relations files is that I can use a number of .osm files together with -c template.args when processing with mkgmap. Now, adding my BNG .osm file in this way, the grid displays with the OSM map data, but only if it follows -c template.args, not if it precedes it. I still haven’t been able to display the grid lines as in my .TYP file, though. I wonder if the Garmin software does not recognise those particular codes. I must say I have always found it very difficult to understand what codes are recognised; it seems a case of trial and error.
Bob

This remains still a mystery to me too. On some units it will display well, on others not. Even with the same units with different firmware versions there might be differences in display…