<!DOCTYPE html>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    Dear Mike,<br>
    <br>
    I looks like your suggestion did the trick. With the following lines
    in the "relations" file I get the desired display of routes in my
    overlay map:<br>
    <br>
    # bicycle routes <br>
    route=bicycle<br>
        {<br>
            apply<br>
                {set route='${route}';set
    route_name='$(route_name),${name}'|'${name}';set
    route_ref='$(route_ref),${ref}'|'${ref}';}<br>
        }<br>
    type=route & route=bicycle & network=icn            {apply
    {add route_icn=yes;}}<br>
    type=route & route=bicycle & network=ncn            {apply
    {add route_ncn=yes;}}<br>
    type=route & route=bicycle & network=rcn            {apply
    {add route_rcn=yes;}}<br>
    type=route & route=bicycle & network=lcn            {apply
    {set route_lcn=yes;}}<br>
    <br>
    # mountainbike routes <br>
    route=mtb<br>
        {<br>
            apply<br>
                {add route_mtb=yes; add
    route_mtb_name='$(route_mtb_name),${name}'|'${name}'; add
    route_mtb_ref='$(route_mtb_ref),${ref}'|'${ref}';}<br>
        }<br>
    <br>
    In the "lines" file I can adjust the zoom-level display and naming.
    For me the following lines work well:<br>
    <br>
    # bicycle routes<br>
    route_icn=yes                                                       
                                                [0x10f01 resolution
    18-20 continue]<br>
    route_icn=yes            {name '${route_ref}'}                   
                                                    [0x10f01 resolution
    20-23 continue]<br>
    route_icn=yes            {name '${route_name}
    (${route_ref})'|'${route_name}'|'${route_ref}'}                   
    [0x10f02 resolution 24]<br>
    <br>
    route_ncn=yes                                                       
                                                [0x10f01 resolution
    20-22 continue]<br>
    route_ncn=yes            {name '${route_ref}'}                   
                                                    [0x10f01 resolution
    23 continue]<br>
    route_ncn=yes            {name '${route_name}
    (${route_ref})'|'${route_name}'|'${route_ref}'}                   
    [0x10f02 resolution 24]<br>
    <br>
    route_rcn=yes                                                       
                                                [0x10f03 resolution
    21-22 continue]<br>
    route_rcn=yes            {name '${route_ref}'}                   
                                                    [0x10f03 resolution
    23 continue]<br>
    route_rcn=yes            {name '${route_name}
    (${route_ref})'|'${route_name}'|'${route_ref}'}                   
    [0x10f04 resolution 24]<br>
    <br>
    route_lcn=yes                                                       
                                                [0x10f05 resolution 23
    continue]<br>
    route_lcn=yes            {name '${route_name}'|'${route_ref}'}   
                                                    [0x10f05 resolution
    24]<br>
    <br>
    # mtb routes<br>
    route_mtb=yes            {name '${route_mtb_ref}'}               
                                                    [0x10f06 resolution
    23 continue]<br>
    route_mtb=yes            {name '${route_mtb_name}
    (${route_mtb_ref})'|'${route_mtb_name}'|'${route_mtb_ref}'}   
    [0x10f06 resolution 24]<br>
    <br>
    Now I can play around, as the display of these lines as overlay map
    on a Garmin Epix watch is quite thin (even with lines up to 18 pixel
    width, having 6-7 pixel width used with a colour and the remaining
    pixels transparent to show the route beside any way). In general, my
    experience is that specially on a watch all bitmap lines are hard to
    see.<br>
    <br>
    Many thanks and regards,<br>
    Bernard<br>
    <br>
    <div class="moz-cite-prefix">Am 27.01.2024 um 16:11 schrieb
      <a class="moz-txt-link-abbreviated" href="mailto:mike@tvage.co.uk">mike@tvage.co.uk</a>:<br>
    </div>
    <blockquote type="cite"
      cite="mid:003801da5133$0be0ba30$23a22e90$@tvage.co.uk">
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      <meta name="Generator"
        content="Microsoft Word 15 (filtered medium)">
      <style>@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;
        color:black;}span.EmailStyle18
        {mso-style-type:personal-reply;
        font-family:"Calibri",sans-serif;
        color:windowtext;}.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;
        mso-ligatures:none;}div.WordSection1
        {page:WordSection1;}</style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
      <div class="WordSection1">
        <p class="MsoNormal"><span
            style="color:windowtext;mso-fareast-language:EN-US">HI
            Bernard,<o:p></o:p></span></p>
        <p class="MsoNormal"><span
            style="color:windowtext;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span
            style="color:windowtext;mso-fareast-language:EN-US">I can’t
            see why bicycle routes should be displaying in the wrong
            order, but if an MTB route runs along a bicycle route and
            its relation is processed after the bicycle one, I think the
            route value will be changed from bicycle to mtb. I suggest
            using add instead of set on the relation statement for </span>mountain
          bike <span
            style="color:windowtext;mso-fareast-language:EN-US">routes:<o:p></o:p></span></p>
        <p class="MsoNormal"><span
            style="color:windowtext;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
        <p class="MsoNormal">type=route & route=mtb<br>
              {<br>
                  apply<br>
                      {add route='${route}'; set
          route_mtb_name='$(route_mtb_name),${name}'|'${name}'; set
          route_mtb_ref='$(route_mtb_ref),${ref}'|'${ref}';}<br>
              }<br>
          <br>
          <span style="color:windowtext;mso-fareast-language:EN-US"><o:p></o:p></span></p>
        <p class="MsoNormal"><span
            style="color:windowtext;mso-fareast-language:EN-US">Regards,<o:p></o:p></span></p>
        <p class="MsoNormal"><span
            style="color:windowtext;mso-fareast-language:EN-US">Mike<o:p></o:p></span></p>
        <p class="MsoNormal"><span
            style="color:windowtext;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
        <div>
          <div
style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm">
            <p class="MsoNormal"><b><span style="color:windowtext"
                  lang="EN-US">From:</span></b><span
                style="color:windowtext" lang="EN-US"> Bernard Mai
                <a class="moz-txt-link-rfc2396E" href="mailto:bm.ffb@gmx.de"><bm.ffb@gmx.de></a> <br>
                <b>Sent:</b> 26 January 2024 10:50<br>
                <b>To:</b> <a class="moz-txt-link-abbreviated" href="mailto:mkgmap-dev@lists.mkgmap.org.uk">mkgmap-dev@lists.mkgmap.org.uk</a><br>
                <b>Subject:</b> [mkgmap-dev] Ranking of relations<o:p></o:p></span></p>
          </div>
        </div>
        <p class="MsoNormal"><o:p> </o:p></p>
        <p class="MsoNormal">Dear all,<br>
          I want to generate an overlay map to be used as additional
          layer on a Garmin watch. This layer can be turned on/off on
          the watch and should show only bicycle routes (route=bicycle
          and route=mtb).<br>
          As most routes in openstreetmap are defined as relations I am
          using the following rules in my bike-routes style:<br>
          <br>
          <b>relations (file)</b><br>
          # Route relations as additional transparent layer for:<br>
          #   bicycle<br>
          #   mtb<br>
          <br>
          # bicycle routes <br>
          type=route & route=bicycle<br>
              {<br>
                  apply<br>
                      {set route='${route}';set
          route_name='$(route_name),${name}'|'${name}';set
          route_ref='$(route_ref),${ref}'|'${ref}';}<br>
              }<br>
          type=route & route=bicycle & network=icn           
          {apply {set route_icn=yes;}}<br>
          type=route & route=bicycle & network=ncn           
          {apply {set route_ncn=yes;}}<br>
          type=route & route=bicycle & network=rcn           
          {apply {set route_rcn=yes;}}<br>
          type=route & route=bicycle & network=lcn           
          {apply {set route_lcn=yes;}}<br>
          <br>
          # mountainbike routes <br>
          type=route & route=mtb<br>
              {<br>
                  apply<br>
                      {set route='${route}'; set
          route_mtb_name='$(route_mtb_name),${name}'|'${name}'; set
          route_mtb_ref='$(route_mtb_ref),${ref}'|'${ref}';}<br>
              }<br>
          <br>
          <b>lines (file)</b><br>
          # bicycle routes<br>
          route=bicycle & route_icn=yes    {name '${route_ref}'}   
                                                          [0x10f01
          resolution 18-22 continue]<br>
          route=bicycle & route_icn=yes    {name '${route_name}
          (${route_ref})'|'${route_name}'|'${route_ref}'}    [0x10f02
          resolution 23-24]<br>
          <br>
          route=bicycle & route_ncn=yes                           
                                                          [0x10f01
          resolution 20-22 continue]<br>
          route=bicycle & route_ncn=yes    {name '${route_ref}'}   
                                                          [0x10f02
          resolution 23 continue]<br>
          route=bicycle & route_ncn=yes    {name '${route_name}
          (${route_ref})'|'${route_name}'|'${route_ref}'}    [0x10f02
          resolution 24]<br>
          <br>
          route=bicycle & route_rcn=yes                           
                                                          [0x10f03
          resolution 20-22 continue]<br>
          route=bicycle & route_rcn=yes    {name '${route_ref}'}   
                                                          [0x10f04
          resolution 23 continue]<br>
          route=bicycle & route_rcn=yes    {name '${route_name}
          (${route_ref})'|'${route_name}'|'${route_ref}'}    [0x10f04
          resolution 24]<br>
          <br>
          route=bicycle & route_lcn=yes    {name '${route_name}
          (${route_ref})'|'${route_name}'|'${route_ref}'}    [0x10f05
          resolution 24]<br>
          <br>
          # mtb routes<br>
          route=mtb     {name '${route_mtb_ref}'}                       
                                                      [0x10f06
          resolution 23 continue]<br>
          route=mtb     {name '${route_mtb_name}
          (${route_mtb_ref})'|'${route_mtb_name}'|'${route_mtb_ref}'}   
              [0x10f06 resolution 24]<br>
          <br>
          <br>
          In general, these routes are drawn by mkgmap and I am able to
          generate an overlay map, but sometimes a route with "lower"
          priority (i. e. a route=mtb) hides a route with "higher"
          priority. In other words, I would like to show the routes in a
          ranking: The routes tagged with network=icn should be on top,
          followed by network=ncn and so on. The route=mtb should be
          only shown, if no other bicycle route is on the same way.<br>
          Is this possible to achieve with mkgmap alone? Or do I need
          some sort of additional script to rank the relations before
          rendering them with mkgmap?<br>
          I have read something, that the draw order depends on the ID
          of the relation and mkgmap renders the lower IDs first. But
          what about the higher relation IDs? It looks like ways tagged
          from the relation only get the tags from the relation with the
          lowest ID. Is this correct?<br>
          Does anybody have an idea, how this could be overcome?<br>
          <br>
          Example:<br>
          Way ID has 3 bicycle relevant relations: relation IDs 2119154,
          9623717,2956920. With the style from above only the last one
          (relation ID 2956920, route=mtb) is shown although the second
          one (relation ID 9623717, network=icn) would be desired as it
          is an international bicycle route.<br>
          <br>
          Regards,<br>
          Bernard<o:p></o:p></p>
      </div>
      <br>
      <fieldset class="moz-mime-attachment-header"></fieldset>
      <pre class="moz-quote-pre" wrap="">_______________________________________________
mkgmap-dev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:mkgmap-dev@lists.mkgmap.org.uk">mkgmap-dev@lists.mkgmap.org.uk</a>
<a class="moz-txt-link-freetext" href="https://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev">https://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev</a></pre>
    </blockquote>
    <br>
  </body>
</html>