logo separator

[mkgmap-dev] Failure to understand apply logic in relations - or failure in the logic

From Felix Hartmann extremecarver at gmail.com on Thu Nov 25 15:17:51 GMT 2021

I think there is a bug in mkgmap.

This line works as intended:
set route_name_hiking1 = '${route_name_hiking1} + ${name|not-contained: +
:route_name_hiking1}' | 'IWN ${name}' | '${route_name_hiking1}' | 'IWN'
while this line in the relations file fails to work as expected - the part
after the + is not added - or at least not visible (strangely the map size
is pretty similar).
set route_name_hiking1 = '${route_name_hiking1} + ${name}' | 'IWN ${name}'
| '${route_name_hiking1}' | 'IWN'


So only by including the not-contained filter ithe relations file is
actually adding the names of the routes after each other - while they are
not added without such a filter.

On Wed, 24 Nov 2021 at 10:45, Felix Hartmann <extremecarver at gmail.com>
wrote:

> I will try your example to see where it goes wrong. Apply_once is about
> forward and backward relations. It should not matter:
> https://www.mkgmap.org.uk/pipermail/mkgmap-dev/2010q1/006268.html
>
> On Tue, 23 Nov 2021, 19:32 Mike Baggaley <mike at tvage.co.uk> wrote:
>
>> Hi Felix,
>>
>>
>>
>> This is what I have in my relations file for routes:
>>
>>
>>
>> type=route & state!=proposed & route~'.*bicycle.*' & network~'.*ncn.*' &
>> ref~'\d*' { apply_once { set nationalbicycleroute=yes; set rn='$(rn) & ${
>> ref|not-contained: & :rn}' | '$(rn)' | '${ref}'; set nrn='$(nrn) & ${
>> ref|not-contained: & :nrn}' | '$(nrn)' | '${ref}'; } }
>>
>> type=route & state!=proposed & route~'.*bicycle.*' & network~'.*rcn.*' &
>> ref~'\d*' { apply_once { set regionalbicycleroute=yes; set rn='$(rn) & ${
>> ref|not-contained: & :rn}' | '$(rn)' | '${ref}'; } }
>>
>> type=route & state!=proposed & (route~'.*foot.*' | route~'.*hiking.*') &
>> network~'.*[nr]wn.*' & name~".*\(.*\)" { set name='${name|subst
>> :"\(.*\)~>"}'}
>>
>> type=route & state!=proposed & (route~'.*foot.*' | route~'.*hiking.*') &
>> network~'.*nwn.*' & name=* { apply_once { set nationalhikingroute=yes;
>> set rn='$(rn) & ${name|not-contained: & :rn}' | '$(rn)' | '${name}'; set
>> nrn='$(nrn) & ${name|not-contained: & :nrn}' | '$(nrn)' | '${name}'; set
>> nwrn='$(nwrn) & ${name|not-contained: & :nwrn}' | '$(nwrn)' | '${name}';
>> } }
>>
>> type=route & state!=proposed & (route~'.*foot.*' | route~'.*hiking.*') &
>> network~'.*rwn.*' & name=* { apply_once { set regionalhikingroute=yes;
>> set rn='$(rn) & ${name|not-contained: & :rn}' | '$(rn)' | '${name}'; } }
>>
>>
>>
>> The most significant difference is that I have apply_once rather than
>> apply.
>>
>>
>>
>> Hope this helps,
>>
>> Mike
>>
>>
>>
>> *From:* Felix Hartmann [mailto:extremecarver at gmail.com]
>> *Sent:* 23 November 2021 13:31
>> *To:* Development list for mkgmap <mkgmap-dev at lists.mkgmap.org.uk>
>> *Subject:* [mkgmap-dev] Failure to understand apply logic in relations -
>> or failure in the logic
>>
>>
>>
>> route=hiking { apply { set route=hiking; set route_name = '${route_name}
>> & ${name}' | '${name}'; add route_ref = '${ref}'; } }
>>
>>
>>
>> I would expect that this rule if several relations are matching one line,
>> adds all names of route=hiking relations to the route_name variable
>> separated by "&". However it is only adding the first found.
>>
>>
>>
>> Where is my mistake?
>>
>>
>>
>> --
>>
>> Felix Hartman - Openmtbmap.org & VeloMap.org
>>
>>
>>
>

-- 
Felix Hartman - Openmtbmap.org & VeloMap.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.mkgmap.org.uk/pipermail/mkgmap-dev/attachments/20211125/d696a8a7/attachment.html>


More information about the mkgmap-dev mailing list