[mkgmap-dev] Patch: New filter "not-contained"
From GerdP gpetermann_muenchen at hotmail.com on Thu Jan 29 20:31:11 GMT 2015
Hi Maxim, I tried to find out if the patch has a side effect, but I failed. From your description I understand that I should be able to produce different results (not using the new filter, just something that workded before) Can you give an example where I should find a difference? Gerd "Maxim Düster" wrote > Hi, Gerd, > > > > I think, there shouldn't be a problem. Actually, if you are using a > filter inside of the apply{} block, you would presumably like to be able > to access the current element from the filter. At the moment you don't > have such a possibility at all. > > If though there will be need to pass a tag from the global relation to the > filter, one can always assign a global tag to a temporary local tag before > calling the filter with this local tag. > > So, in my mind, nothing should go wrong here. Perhaps someone else can say > something more regarding this issue. > > > > Max > > > > Gesendet: Donnerstag, 29. Januar 2015 um 18:30 Uhr > Von: GerdP < > gpetermann_muenchen@ > > > An: > mkgmap-dev at .org > > Betreff: Re: [mkgmap-dev] Patch: New filter "not-contained" > > Hi Max, > > not sure. What will happen if one uses another filter in the relations > file? > > Gerd > > > &quot;Maxim Düster&quot; wrote > > Hi, Gerd, > > > > &nbsp; > > > > the change is caused by the fact that the filter was thought > primarily for > > working in relations file inside of the apply{} block and needs that > the > > tag given as last parameter is a local tag of the element being > processed > > (e.g. a way). But the old code line says: &quot;value = > > filter.filter(tagval,el);&quot;, &#39;el&#39; being the > parent relation > > the way is in. That is, in the filter I only have an access to the > > (global) relation&#39;s tags, but what I actually need are the > tags of the > > (local) element being currently processed. > > > > While applying filters to &quot;plain&quot; elements (those > not inside a > > relation, e.g. in points or lines files), &#39;local_el&#39; > and > > &#39;el&#39; are equal, so my change should not corrupt > anything. > > > > &nbsp; > > > > Max > > > > &nbsp; > > > > Gesendet:&nbsp;Donnerstag, 29. Januar 2015 um 11:20 Uhr > > Von:&nbsp;&quot;Gerd Petermann&quot; &lt; > > > gpetermann_muenchen@ > > > &gt; > > An:&nbsp;&quot; > > > mkgmap-dev at .org > > > &quot; &lt; > > > mkgmap-dev at .org > > > &gt; > > Betreff:&nbsp;Re: [mkgmap-dev] Patch: New filter > &quot;not-contained&quot; > > > > > > > > Hi Maxim, > > > > please can you explain the reason for the change in ValueItem? > > > > Gerd > > &nbsp; > > > > From: > > > maxc@ > > > > > To: > > > mkgmap-dev at .org > > > > > Date: Wed, 28 Jan 2015 12:12:25 +0100 > > Subject: [mkgmap-dev] Patch: New filter > &quot;not-contained&quot; > > &nbsp; > > > > Hello! > > &nbsp; > > I&#39;ve attached a patch with a new filter that helps while > processing, > > for example, public transport relations. The reason: there can be > multiple > > route relations with the same ref attribute (for example, one for the > > forward direction, one for the return direction), combined to a > > route_master relation. > > > > If you want a name for a way to contain the refs of all of the routes > > going through that way, you have a problem that some refs will be > present > > more than once, similar to &quot;1,1,2,2,2&quot; (if we > assume that route > > 1 has two instances, and route 2 - three instances). > > > > The new filter helps to circumvent this. It takes 2 parameters: a > > delimiter (a comma in the example above) and the name of a tag > containg > > the list. The filter works a bit like the > &quot;not-equal&quot; filter, > > but it doesn&#39;t just compare two values; instead it looks if > the > > tag&#39;s value (to which the filter is being applied) is > contained in the > > list from the (other) given tag. If it is not the case, the value can > be > > added to the list, otherwise the tag is considered unset. > > > > &nbsp; > > > > Simple example for relations file: > > > > &nbsp; > > > > type=route &amp; route=bus &amp; ref=* { > > &nbsp;&nbsp; apply { > > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; set > > > route_ref=&#39;&#36;(route_ref),&#36;{ref&#124;not-contained:,:route_ref}&#39; > > &#124; &#39;&#36;(route_ref)&#39; &#124; > &#39;&#36;{ref}&#39;; > > &nbsp;&nbsp; } > > } > > > > &nbsp; > > > > Here, ref value is only added to route_ref if it is not already > contained > > in that list (with separator &#39;,&#39;). Otherwise, the > value of > > route_ref is unchanged. > > &nbsp; > > Cheers! > > Max > > > > > > _______________________________________________ mkgmap-dev mailing > list > > > mkgmap-dev at .org > > > http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev > > > > _______________________________________________ mkgmap-dev mailing > list > > > mkgmap-dev at .org > > > http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev > > > > > > > > > > > > _______________________________________________ > > mkgmap-dev mailing list > > > mkgmap-dev at .org > > > http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev > > > > > > -- > View this message in context: > http://gis.19327.n5.nabble.com/Patch-New-filter-not-contained-tp5831668p5831841.html > Sent from the Mkgmap Development mailing list archive at Nabble.com. > _______________________________________________ > mkgmap-dev mailing list > mkgmap-dev at .org > > http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev > > > > > _______________________________________________ > mkgmap-dev mailing list > mkgmap-dev at .org > http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev -- View this message in context: http://gis.19327.n5.nabble.com/Patch-New-filter-not-contained-tp5831668p5831869.html Sent from the Mkgmap Development mailing list archive at Nabble.com.
- Previous message: [mkgmap-dev] Patch: New filter "not-contained"
- Next message: [mkgmap-dev] Patch: New filter "not-contained"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the mkgmap-dev mailing list