logo separator

[mkgmap-dev] Ranking of relations

From Gerd Petermann gpetermann_muenchen at hotmail.com on Sat Jan 27 08:10:36 GMT 2024

Hi Bernard,

I think the problem is in the block
type=route & route=bicycle & network=icn            {apply {set route_icn=yes;}}
type=route & route=bicycle & network=ncn            {apply {set route_ncn=yes;}}
type=route & route=bicycle & network=rcn            {apply {set route_rcn=yes;}}
type=route & route=bicycle & network=lcn            {apply {set route_lcn=yes;}}

Whatever relation type comes last overwrites the values for the other. You have to collect (concatenate) the different values instead of replacing.
I think the clause above shows how that works.

Gerd

________________________________________
Von: mkgmap-dev <mkgmap-dev-bounces at lists.mkgmap.org.uk> im Auftrag von Bernard Mai <bm.ffb at gmx.de>
Gesendet: Freitag, 26. Januar 2024 11:50
An: mkgmap-dev at lists.mkgmap.org.uk
Betreff: [mkgmap-dev] Ranking of relations

Dear all,
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).
As most routes in openstreetmap are defined as relations I am using the following rules in my bike-routes style:

relations (file)
# Route relations as additional transparent layer for:
#   bicycle
#   mtb

# bicycle routes
type=route & route=bicycle
    {
        apply
            {set route='${route}';set route_name='$(route_name),${name}'|'${name}';set route_ref='$(route_ref),${ref}'|'${ref}';}
    }
type=route & route=bicycle & network=icn            {apply {set route_icn=yes;}}
type=route & route=bicycle & network=ncn            {apply {set route_ncn=yes;}}
type=route & route=bicycle & network=rcn            {apply {set route_rcn=yes;}}
type=route & route=bicycle & network=lcn            {apply {set route_lcn=yes;}}

# mountainbike routes
type=route & route=mtb
    {
        apply
            {set route='${route}'; set route_mtb_name='$(route_mtb_name),${name}'|'${name}'; set route_mtb_ref='$(route_mtb_ref),${ref}'|'${ref}';}
    }

lines (file)
# bicycle routes
route=bicycle & route_icn=yes    {name '${route_ref}'}                                                    [0x10f01 resolution 18-22 continue]
route=bicycle & route_icn=yes    {name '${route_name} (${route_ref})'|'${route_name}'|'${route_ref}'}    [0x10f02 resolution 23-24]

route=bicycle & route_ncn=yes                                                                            [0x10f01 resolution 20-22 continue]
route=bicycle & route_ncn=yes    {name '${route_ref}'}                                                    [0x10f02 resolution 23 continue]
route=bicycle & route_ncn=yes    {name '${route_name} (${route_ref})'|'${route_name}'|'${route_ref}'}    [0x10f02 resolution 24]

route=bicycle & route_rcn=yes                                                                            [0x10f03 resolution 20-22 continue]
route=bicycle & route_rcn=yes    {name '${route_ref}'}                                                    [0x10f04 resolution 23 continue]
route=bicycle & route_rcn=yes    {name '${route_name} (${route_ref})'|'${route_name}'|'${route_ref}'}    [0x10f04 resolution 24]

route=bicycle & route_lcn=yes    {name '${route_name} (${route_ref})'|'${route_name}'|'${route_ref}'}    [0x10f05 resolution 24]

# mtb routes
route=mtb     {name '${route_mtb_ref}'}                                                                    [0x10f06 resolution 23 continue]
route=mtb     {name '${route_mtb_name} (${route_mtb_ref})'|'${route_mtb_name}'|'${route_mtb_ref}'}        [0x10f06 resolution 24]


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.
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?
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?
Does anybody have an idea, how this could be overcome?

Example:
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.

Regards,
Bernard


More information about the mkgmap-dev mailing list