<html><head></head><body><div style="font-family: Verdana;font-size: 12.0px;"><div>
<div>Hi, Gerd,</div>
<div> </div>
<div>glad to hear it) Thank you</div>
<div> </div>
<div>Max</div>
<div>
<div name="quote" style="margin:10px 5px 5px 10px; padding: 10px 0 10px 10px; border-left:2px solid #C3D9E5; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">
<div style="margin:0 0 10px 0;"><b>Gesendet:</b> Freitag, 30. Januar 2015 um 16:35 Uhr<br/>
<b>Von:</b> GerdP <gpetermann_muenchen@hotmail.com><br/>
<b>An:</b> mkgmap-dev@lists.mkgmap.org.uk<br/>
<b>Betreff:</b> Re: [mkgmap-dev] Patch: New filter "not-contained"</div>
<div name="quoted-content">Hi Max,<br/>
<br/>
okay, thanks for the explanation. I think I understand now.<br/>
I think we can say that your patch is also a correction and<br/>
the "side effect" is in fact the better solution.<br/>
<br/>
I've committed the patch with r3422.<br/>
<br/>
Gerd<br/>
<br/>
<br/>
<br/>
&quot;Maxim Düster&quot; wrote<br/>
> Hi, Gerd,<br/>
><br/>
> &nbsp;<br/>
><br/>
> well, it&#39;s indeed not so easy to find an example. In most cases you<br/>
> won&#39;t see any difference because almost no existent filter uses the<br/>
> second parameter in the filter()/doFilter() method. The only one using it,<br/>
> besides the proposed new filter, is the &#39;not-equal&#39; filter. The<br/>
> example I found for using it inside the apply{} block is a bit artificial<br/>
> and probably not really meaningful, but I hope, it gives the idea.<br/>
><br/>
> Assume, you want to find and visualize a specifical type of errors in<br/>
> data, namely streets being part of an associatedStreet relation but having<br/>
> a different name than the relation itself. To get this, you could do in<br/>
> relations file something like:<br/>
><br/>
> &nbsp;<br/>
><br/>
> type=associatedStreet &amp; name=* {<br/>
> &nbsp;&nbsp; &nbsp;apply {<br/>
> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;set<br/>
> nameInRelation=&#39;&#36;{name&#124;not-equal:name}&#39;;<br/>
> &nbsp;&nbsp; &nbsp;}<br/>
> }<br/>
><br/>
> &nbsp;<br/>
><br/>
> where you want to compare the relation&#39;s name with the street&#39;s<br/>
> name and to remember the relation&#39;s name if it&#39;s different.<br/>
><br/>
> Then, in lines file, you could write something like<br/>
><br/>
> &nbsp;<br/>
><br/>
><br/>
> highway=* &amp; nameInRelation=* [...]<br/>
><br/>
> &lt;finalize&gt;<br/>
> name=* { name &#39;&#36;{name}/&#36;{nameInRelation}&#39; }<br/>
><br/>
> &nbsp;<br/>
><br/>
> to highlight the differences. So, and now, with the current mkgmap code<br/>
> both &quot;name&quot;s referenced in the &#39;set&#39; command are the<br/>
> same, namely it&#39;s the name of the relation. You cannot pass the<br/>
> current street&#39;s name to the filter. After running mkgmap you get a<br/>
> map without any street as for every street holds name=name and so<br/>
> nameInRelation is not set.<br/>
><br/>
> &nbsp;<br/>
><br/>
> You could also try to pass a differently named tag to the filter by saving<br/>
> the street&#39;s name in a temporary tag, like:<br/>
><br/>
> &nbsp;<br/>
><br/>
> type=associatedStreet &amp; name=* {<br/>
> &nbsp;&nbsp; &nbsp;apply {<br/>
><br/>
> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;set myname=&#39;&#36;(name)&#39;;<br/>
> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;set<br/>
> nameInRelation=&#39;&#36;{name&#124;not-equal:myname}&#39;;<br/>
> &nbsp;&nbsp; &nbsp;}<br/>
> }<br/>
><br/>
><br/>
><br/>
> &nbsp;<br/>
><br/>
> But in this case, the tag &#39;myname&#39; would also be looked for in the<br/>
> relation, not in the street&#39;s tags, and as the relation doesn&#39;t<br/>
> have such a tag, nameInRelation is always set to the relation&#39;s name<br/>
> and so you see in your map all the streets, not only the erroneous ones.<br/>
> So, either all or no at all.<br/>
><br/>
> &nbsp;<br/>
><br/>
> With the proposed change, however, the filter gets a local element as a<br/>
> second parameter in doFilter(), so in both cases the name of the relation<br/>
> would be compared to the (local) tags of the current street (either name<br/>
> or myname) and you would get only streets with errors in the map.<br/>
><br/>
> The new filter is specifically designed for using in the apply{} block, so<br/>
> it necessarily needs an access to the local object.<br/>
><br/>
> &nbsp;<br/>
><br/>
> So, to summarize my reasoning: the functionality of no existent filter<br/>
> would break after the patch (almost all filters would not see any<br/>
> difference, one would potentially benefit from the change and one requires<br/>
> it). Writers of new filters would not, in my opinion, have any troubles<br/>
> with it, too. If they would need a local element, they get it for free. If<br/>
> they would need a global element, one can always save global tags in the<br/>
> local element and then call the filter with the local element.<br/>
><br/>
> &nbsp;<br/>
><br/>
> What do you think about it now? Could I convince you? :)<br/>
><br/>
> &nbsp;<br/>
><br/>
> Max<br/>
><br/>
> &nbsp;<br/>
><br/>
><br/>
> Gesendet:&nbsp;Donnerstag, 29. Januar 2015 um 23:31 Uhr<br/>
> Von:&nbsp;GerdP &lt;<br/>
<br/>
> gpetermann_muenchen@<br/>
<br/>
> &gt;<br/>
> An:&nbsp;<br/>
<br/>
> mkgmap-dev@.org<br/>
<br/>
><br/>
> Betreff:&nbsp;Re: [mkgmap-dev] Patch: New filter &quot;not-contained&quot;<br/>
><br/>
> Hi Maxim,<br/>
><br/>
> I tried to find out if the patch has a side effect, but<br/>
> I failed. From your description I understand that<br/>
> I should be able to produce different results (not<br/>
> using the new filter, just something that workded before)<br/>
><br/>
> Can you give an example where I should find a difference?<br/>
><br/>
> Gerd<br/>
><br/>
><br/>
> &amp;quot;Maxim D&uuml;ster&amp;quot; wrote<br/>
> &gt; Hi, Gerd,<br/>
> &gt;<br/>
> &gt; &amp;nbsp;<br/>
> &gt;<br/>
> &gt; I think, there shouldn&amp;#39;t be a problem. Actually, if you are<br/>
> using a<br/>
> &gt; filter inside of the apply{} block, you would presumably like to be<br/>
> able<br/>
> &gt; to access the current element from the filter. At the moment you<br/>
> don&amp;#39;t<br/>
> &gt; have such a possibility at all.<br/>
> &gt;<br/>
> &gt; If though there will be need to pass a tag from the global relation<br/>
> to the<br/>
> &gt; filter, one can always assign a global tag to a temporary local tag<br/>
> before<br/>
> &gt; calling the filter with this local tag.<br/>
> &gt;<br/>
> &gt; So, in my mind, nothing should go wrong here. Perhaps someone else<br/>
> can say<br/>
> &gt; something more regarding this issue.<br/>
> &gt;<br/>
> &gt; &amp;nbsp;<br/>
> &gt;<br/>
> &gt; Max<br/>
> &gt;<br/>
> &gt; &amp;nbsp;<br/>
> &gt;<br/>
> &gt; Gesendet:&amp;nbsp;Donnerstag, 29. Januar 2015 um 18:30 Uhr<br/>
> &gt; Von:&amp;nbsp;GerdP &amp;lt;<br/>
><br/>
> &gt; gpetermann_muenchen@<br/>
><br/>
> &gt; &amp;gt;<br/>
> &gt; An:&amp;nbsp;<br/>
><br/>
> &gt; mkgmap-dev@.org<br/>
><br/>
> &gt;<br/>
> &gt; Betreff:&amp;nbsp;Re: [mkgmap-dev] Patch: New filter<br/>
> &amp;quot;not-contained&amp;quot;<br/>
> &gt;<br/>
> &gt; Hi Max,<br/>
> &gt;<br/>
> &gt; not sure. What will happen if one uses another filter in the<br/>
> relations<br/>
> &gt; file?<br/>
> &gt;<br/>
> &gt; Gerd<br/>
> &gt;<br/>
> &gt;<br/>
> &gt; &amp;amp;quot;Maxim D&amp;uuml;ster&amp;amp;quot; wrote<br/>
> &gt; &amp;gt; Hi, Gerd,<br/>
> &gt; &amp;gt;<br/>
> &gt; &amp;gt; &amp;amp;nbsp;<br/>
> &gt; &amp;gt;<br/>
> &gt; &amp;gt; the change is caused by the fact that the filter was thought<br/>
> &gt; primarily for<br/>
> &gt; &amp;gt; working in relations file inside of the apply{} block and<br/>
> needs that<br/>
> &gt; the<br/>
> &gt; &amp;gt; tag given as last parameter is a local tag of the element<br/>
> being<br/>
> &gt; processed<br/>
> &gt; &amp;gt; (e.g. a way). But the old code line says:<br/>
> &amp;amp;quot;value =<br/>
> &gt; &amp;gt; filter.filter(tagval,el);&amp;amp;quot;,<br/>
> &amp;amp;#39;el&amp;amp;#39; being the<br/>
> &gt; parent relation<br/>
> &gt; &amp;gt; the way is in. That is, in the filter I only have an access<br/>
> to the<br/>
> &gt; &amp;gt; (global) relation&amp;amp;#39;s tags, but what I actually<br/>
> need are the<br/>
> &gt; tags of the<br/>
> &gt; &amp;gt; (local) element being currently processed.<br/>
> &gt; &amp;gt;<br/>
> &gt; &amp;gt; While applying filters to &amp;amp;quot;plain&amp;amp;quot;<br/>
> elements (those<br/>
> &gt; not inside a<br/>
> &gt; &amp;gt; relation, e.g. in points or lines files),<br/>
> &amp;amp;#39;local_el&amp;amp;#39;<br/>
> &gt; and<br/>
> &gt; &amp;gt; &amp;amp;#39;el&amp;amp;#39; are equal, so my change should<br/>
> not corrupt<br/>
> &gt; anything.<br/>
> &gt; &amp;gt;<br/>
> &gt; &amp;gt; &amp;amp;nbsp;<br/>
> &gt; &amp;gt;<br/>
> &gt; &amp;gt; Max<br/>
> &gt; &amp;gt;<br/>
> &gt; &amp;gt; &amp;amp;nbsp;<br/>
> &gt; &amp;gt;<br/>
> &gt; &amp;gt; Gesendet:&amp;amp;nbsp;Donnerstag, 29. Januar 2015 um 11:20<br/>
> Uhr<br/>
> &gt; &amp;gt; Von:&amp;amp;nbsp;&amp;amp;quot;Gerd Petermann&amp;amp;quot;<br/>
> &amp;amp;lt;<br/>
> &gt;<br/>
> &gt; &amp;gt; gpetermann_muenchen@<br/>
> &gt;<br/>
> &gt; &amp;gt; &amp;amp;gt;<br/>
> &gt; &amp;gt; An:&amp;amp;nbsp;&amp;amp;quot;<br/>
> &gt;<br/>
> &gt; &amp;gt; mkgmap-dev@.org<br/>
> &gt;<br/>
> &gt; &amp;gt; &amp;amp;quot; &amp;amp;lt;<br/>
> &gt;<br/>
> &gt; &amp;gt; mkgmap-dev@.org<br/>
> &gt;<br/>
> &gt; &amp;gt; &amp;amp;gt;<br/>
> &gt; &amp;gt; Betreff:&amp;amp;nbsp;Re: [mkgmap-dev] Patch: New filter<br/>
> &gt; &amp;amp;quot;not-contained&amp;amp;quot;<br/>
> &gt; &amp;gt;<br/>
> &gt; &amp;gt;<br/>
> &gt; &amp;gt;<br/>
> &gt; &amp;gt; Hi Maxim,<br/>
> &gt; &amp;gt;<br/>
> &gt; &amp;gt; please can you explain the reason for the change in<br/>
> ValueItem?<br/>
> &gt; &amp;gt;<br/>
> &gt; &amp;gt; Gerd<br/>
> &gt; &amp;gt; &amp;amp;nbsp;<br/>
> &gt; &amp;gt;<br/>
> &gt; &amp;gt; From:<br/>
> &gt;<br/>
> &gt; &amp;gt; maxc@<br/>
> &gt;<br/>
> &gt; &amp;gt;<br/>
> &gt; &amp;gt; To:<br/>
> &gt;<br/>
> &gt; &amp;gt; mkgmap-dev@.org<br/>
> &gt;<br/>
> &gt; &amp;gt;<br/>
> &gt; &amp;gt; Date: Wed, 28 Jan 2015 12:12:25 +0100<br/>
> &gt; &amp;gt; Subject: [mkgmap-dev] Patch: New filter<br/>
> &gt; &amp;amp;quot;not-contained&amp;amp;quot;<br/>
> &gt; &amp;gt; &amp;amp;nbsp;<br/>
> &gt; &amp;gt;<br/>
> &gt; &amp;gt; Hello!<br/>
> &gt; &amp;gt; &amp;amp;nbsp;<br/>
> &gt; &amp;gt; I&amp;amp;#39;ve attached a patch with a new filter that<br/>
> helps while<br/>
> &gt; processing,<br/>
> &gt; &amp;gt; for example, public transport relations. The reason: there<br/>
> can be<br/>
> &gt; multiple<br/>
> &gt; &amp;gt; route relations with the same ref attribute (for example,<br/>
> one for the<br/>
> &gt; &amp;gt; forward direction, one for the return direction), combined<br/>
> to a<br/>
> &gt; &amp;gt; route_master relation.<br/>
> &gt; &amp;gt;<br/>
> &gt; &amp;gt; If you want a name for a way to contain the refs of all of<br/>
> the routes<br/>
> &gt; &amp;gt; going through that way, you have a problem that some refs<br/>
> will be<br/>
> &gt; present<br/>
> &gt; &amp;gt; more than once, similar to<br/>
> &amp;amp;quot;1,1,2,2,2&amp;amp;quot; (if we<br/>
> &gt; assume that route<br/>
> &gt; &amp;gt; 1 has two instances, and route 2 - three instances).<br/>
> &gt; &amp;gt;<br/>
> &gt; &amp;gt; The new filter helps to circumvent this. It takes 2<br/>
> parameters: a<br/>
> &gt; &amp;gt; delimiter (a comma in the example above) and the name of a<br/>
> tag<br/>
> &gt; containg<br/>
> &gt; &amp;gt; the list. The filter works a bit like the<br/>
> &gt; &amp;amp;quot;not-equal&amp;amp;quot; filter,<br/>
> &gt; &amp;gt; but it doesn&amp;amp;#39;t just compare two values; instead<br/>
> it looks if<br/>
> &gt; the<br/>
> &gt; &amp;gt; tag&amp;amp;#39;s value (to which the filter is being<br/>
> applied) is<br/>
> &gt; contained in the<br/>
> &gt; &amp;gt; list from the (other) given tag. If it is not the case, the<br/>
> value can<br/>
> &gt; be<br/>
> &gt; &amp;gt; added to the list, otherwise the tag is considered unset.<br/>
> &gt; &amp;gt;<br/>
> &gt; &amp;gt; &amp;amp;nbsp;<br/>
> &gt; &amp;gt;<br/>
> &gt; &amp;gt; Simple example for relations file:<br/>
> &gt; &amp;gt;<br/>
> &gt; &amp;gt; &amp;amp;nbsp;<br/>
> &gt; &amp;gt;<br/>
> &gt; &amp;gt; type=route &amp;amp;amp; route=bus &amp;amp;amp; ref=* {<br/>
> &gt; &amp;gt; &amp;amp;nbsp;&amp;amp;nbsp; apply {<br/>
> &gt; &amp;gt;<br/>
> &amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; set<br/>
> &gt; &amp;gt;<br/>
> &gt;<br/>
> route_ref=&amp;amp;#39;&amp;amp;#36;(route_ref),&amp;amp;#36;{ref&amp;amp;#124;not-contained:,:route_ref}&amp;amp;#39;<br/>
> &gt; &amp;gt; &amp;amp;#124;<br/>
> &amp;amp;#39;&amp;amp;#36;(route_ref)&amp;amp;#39; &amp;amp;#124;<br/>
> &gt; &amp;amp;#39;&amp;amp;#36;{ref}&amp;amp;#39;;<br/>
> &gt; &amp;gt; &amp;amp;nbsp;&amp;amp;nbsp; }<br/>
> &gt; &amp;gt; }<br/>
> &gt; &amp;gt;<br/>
> &gt; &amp;gt; &amp;amp;nbsp;<br/>
> &gt; &amp;gt;<br/>
> &gt; &amp;gt; Here, ref value is only added to route_ref if it is not<br/>
> already<br/>
> &gt; contained<br/>
> &gt; &amp;gt; in that list (with separator &amp;amp;#39;,&amp;amp;#39;).<br/>
> Otherwise, the<br/>
> &gt; value of<br/>
> &gt; &amp;gt; route_ref is unchanged.<br/>
> &gt; &amp;gt; &amp;amp;nbsp;<br/>
> &gt; &amp;gt; Cheers!<br/>
> &gt; &amp;gt; Max<br/>
> &gt; &amp;gt;<br/>
> &gt; &amp;gt;<br/>
> &gt; &amp;gt; _______________________________________________ mkgmap-dev<br/>
> mailing<br/>
> &gt; list<br/>
> &gt;<br/>
> &gt; &amp;gt; mkgmap-dev@.org<br/>
> &gt;<br/>
> &gt; &amp;gt; <a href="http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev" target="_blank">http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev</a><br/>
> &gt; &amp;gt;<br/>
> &gt; &amp;gt; _______________________________________________ mkgmap-dev<br/>
> mailing<br/>
> &gt; list<br/>
> &gt;<br/>
> &gt; &amp;gt; mkgmap-dev@.org<br/>
> &gt;<br/>
> &gt; &amp;gt; <a href="http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev" target="_blank">http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev</a><br/>
> &gt; &amp;gt;<br/>
> &gt; &amp;gt;<br/>
> &gt; &amp;gt;<br/>
> &gt; &amp;gt;<br/>
> &gt; &amp;gt;<br/>
> &gt; &amp;gt; _______________________________________________<br/>
> &gt; &amp;gt; mkgmap-dev mailing list<br/>
> &gt;<br/>
> &gt; &amp;gt; mkgmap-dev@.org<br/>
> &gt;<br/>
> &gt; &amp;gt; <a href="http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev" target="_blank">http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev</a><br/>
> &gt;<br/>
> &gt;<br/>
> &gt;<br/>
> &gt;<br/>
> &gt;<br/>
> &gt; --<br/>
> &gt; View this message in context:<br/>
> &gt;<br/>
> <a href="http://gis.19327.n5.nabble.com/Patch-New-filter-not-contained-tp5831668p5831841.html" target="_blank">http://gis.19327.n5.nabble.com/Patch-New-filter-not-contained-tp5831668p5831841.html</a><br/>
> &gt; Sent from the Mkgmap Development mailing list archive at Nabble.com.<br/>
> &gt; _______________________________________________<br/>
> &gt; mkgmap-dev mailing list<br/>
><br/>
> &gt; mkgmap-dev@.org<br/>
><br/>
> &gt;<br/>
> &gt; <a href="http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev" target="_blank">http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev</a><br/>
> &gt;<br/>
> &gt;<br/>
> &gt;<br/>
> &gt;<br/>
> &gt; _______________________________________________<br/>
> &gt; mkgmap-dev mailing list<br/>
><br/>
> &gt; mkgmap-dev@.org<br/>
><br/>
> &gt; <a href="http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev" target="_blank">http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev</a><br/>
><br/>
><br/>
><br/>
><br/>
><br/>
> --<br/>
> View this message in context:<br/>
> <a href="http://gis.19327.n5.nabble.com/Patch-New-filter-not-contained-tp5831668p5831869.html" target="_blank">http://gis.19327.n5.nabble.com/Patch-New-filter-not-contained-tp5831668p5831869.html</a><br/>
> Sent from the Mkgmap Development mailing list archive at Nabble.com.<br/>
> _______________________________________________<br/>
> mkgmap-dev mailing list<br/>
<br/>
> mkgmap-dev@.org<br/>
<br/>
><br/>
> <a href="http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev" target="_blank">http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev</a><br/>
><br/>
><br/>
><br/>
><br/>
> _______________________________________________<br/>
> mkgmap-dev mailing list<br/>
<br/>
> mkgmap-dev@.org<br/>
<br/>
> <a href="http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev" target="_blank">http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev</a><br/>
<br/>
<br/>
<br/>
<br/>
<br/>
--<br/>
View this message in context: <a href="http://gis.19327.n5.nabble.com/Patch-New-filter-not-contained-tp5831668p5831947.html" target="_blank">http://gis.19327.n5.nabble.com/Patch-New-filter-not-contained-tp5831668p5831947.html</a><br/>
Sent from the Mkgmap Development mailing list archive at Nabble.com.<br/>
_______________________________________________<br/>
mkgmap-dev mailing list<br/>
mkgmap-dev@lists.mkgmap.org.uk<br/>
<a href="http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev" target="_blank">http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev</a></div>
</div>
</div>
</div></div></body></html>