<!doctype html>
<html>
<head>
<meta charset="UTF-8">
</head>
<body>
<div>
Hi Gerd,
</div>
<div>
<br>
</div>
<div>
thank you for your work!
</div>
<div>
<br>
</div>
<div>
My Test:
</div>
<div>
in "lines" i wrote
</div>
<div>
highway=* & bicycle!=* & is_in(landuse,cemetery,all)=true { name'${LangBez}'} [0x10100 resolution 24 ]
</div>
<div>
0x10100 is motorway :) (purple line)
</div>
<div>
i test it also with "any", same result.
</div>
<div>
<br>
</div>
<div>
Some ways on cementary are motorways, some not.
</div>
<div>
For example:
</div>
<div>
N51° 10.939' E7° 11.712'
</div>
<div>
<img src="cid:564ee5d80b6444d8bb916ad790dee3bc@Open-Xchange" style="max-width: 100%;" class="aspect-ratio" alt="" data-pending="true" data-id="upload-image-2663" from_clipboard="true">
<br>
</div>
<div>
<br>
</div>
<div>
<br>
</div>
<div>
greets
</div>
<div>
<br>
</div>
<div>
Arndt
</div>
<blockquote type="cite">
<div>
Gerd Petermann <
<a href="mailto:gpetermann_muenchen@hotmail.com">gpetermann_muenchen@hotmail.com</a>> hat am 9. Januar 2020 um 14:53 geschrieben:
</div>
<div>
<br>
</div>
<div>
<br>
</div>
<div>
Hi Nick,
</div>
<div>
<br>
</div>
<div>
sorry, my example was wrong. Here is the corrected version:
</div>
<div>
highway=* & bicycle!=* & is_in(landuse,cemetery,all)=true {add bicycle=dismount}
</div>
<div>
<br>
</div>
<div>
The function returns a value (true or false) which has to be tested.
</div>
<div>
<br>
</div>
<div>
Gerd
</div>
<div>
<br>
</div>
<div>
________________________________________
</div>
<div>
Von: mkgmap-dev <
<a href="mailto:mkgmap-dev-bounces@lists.mkgmap.org.uk">mkgmap-dev-bounces@lists.mkgmap.org.uk</a>> im Auftrag von Pinns UK <
<a href="mailto:osm@pinns.co.uk">osm@pinns.co.uk</a>>
</div>
<div>
Gesendet: Donnerstag, 9. Januar 2020 14:50
</div>
<div>
An:
<a href="mailto:mkgmap-dev@lists.mkgmap.org.uk">mkgmap-dev@lists.mkgmap.org.uk</a>
</div>
<div>
Betreff: Re: [mkgmap-dev] Branch is_in ready for a first test
</div>
<div>
<br>
</div>
<div>
Hi Gerd
</div>
<div>
<br>
</div>
<div>
I used the latest
<a href="http://www.mkgmap.org.uk/download/mkgmap-is-in-r4408.zip" rel="noopener" target="_blank">http://www.mkgmap.org.uk/download/mkgmap-is-in-r4408.zip</a>
</div>
<div>
<br>
</div>
<div>
I added
</div>
<div>
<br>
</div>
<div>
highway=* & bicycle!=* & is_in(landuse,cemetery,all) {add bicycle=dismount}
</div>
<div>
<br>
</div>
<div>
& get
</div>
<div>
<br>
</div>
<div>
Error in style: Error: (lines:22): Value 'is_in()[landuse, cemetery,
</div>
<div>
all]' is not part of an expression
</div>
<div>
Error in style: Error: (lines:22): Value 'is_in()[landuse, cemetery,
</div>
<div>
all]' is not part of an expression
</div>
<div>
Error in style: Error: (lines:22): Value 'is_in()[landuse, cemetery,
</div>
<div>
all]' is not part of an expression
</div>
<div>
<br>
</div>
<div>
Am I missing something ?
</div>
<div>
<br>
</div>
<div>
I'm confused about which option if any is required
</div>
<div>
<br>
</div>
<div>
If I use
</div>
<div>
<br>
</div>
<div>
--is-in-hook=landuse
</div>
<div>
<br>
</div>
<div>
I get an invalid option error
</div>
<div>
<br>
</div>
<div>
r
</div>
<div>
<br>
</div>
<div>
Nick
</div>
<div>
<br>
</div>
<div>
On 09/01/2020 11:43, Gerd Petermann wrote:
</div>
<blockquote type="cite">
<div>
Hi all,
</div>
</blockquote>
<blockquote type="cite">
<div>
the branch version r4408 implements the style function is_in with three parameters tag-key,tag-value,method
</div>
<div>
- tag-key can be something like landuse or natural or amenity
</div>
<div>
- tag-value would be the expected value for that tag-key
</div>
<div>
- method has to be "any" or "all".
</div>
</blockquote>
<blockquote type="cite">
<div>
Example usage in lines:
</div>
<div>
# no cycling within a cemetery
</div>
<div>
highway=* & bicycle!=* & is_in(landuse,cemetery,all) {add bicycle=dismount}
</div>
</blockquote>
<blockquote type="cite">
<div>
Before any style rule is evaluated the function evaluates the list of all ways found in the input file. When a way matches the given tag (key+value) and is closed and complete the shape geometry is stored in a spatial index.
</div>
<div>
With the current implementation this index is created for appearance of the is_in function in a style rule (subject to optimization)
</div>
</blockquote>
<blockquote type="cite">
<div>
When the style function is called it retrieves the stored shape(s) which intersect the boundary of the element.
</div>
<div>
If none is found "false" is returned.
</div>
<div>
If there are multiple such shapes the are merged where possible, so that overlapping or touching shapes are combined to a single shape which may include holes.
</div>
<div>
The list of (outer) shapes is then tested one after the other until one shape is found which either contains the element completely or - when "any" is used as method - partially. If none is found the value "false" is returned.
</div>
<div>
If a match is found and the combined shapes have holes, a final test is done to find out if the element is within the hole.
</div>
<div>
If method "any" is used and the shape is completey within one hole "false" is returned.
</div>
<div>
If method "all" is used and the shape is partly within one hole "false" is returned.
</div>
<div>
If we get here true is "returned"
</div>
</blockquote>
<blockquote type="cite">
<div>
I've also slightly changed the behaviour of the LocationHook and the ResidentialHook. The results should be a bit more predictable now as searches are done with higher precsion. Still, both try to find a nearby boundary(shape) if none is found at the exact position.
</div>
<div>
The ResidentialHook is now automatically disabled when the style doesn't use mkgmap:residential anywhere.
</div>
</blockquote>
<blockquote type="cite">
<div>
TODO:
</div>
<div>
- various possible special cases need more testing
</div>
<div>
- maybe add more methods for cases where parts of the tested element touch the boundary of the shape.
</div>
<div>
- tuning
</div>
<div>
- unit tests
</div>
</blockquote>
<blockquote type="cite">
<div>
As always with branch version the binary can be found at the bottom of the download page.
</div>
<div>
<a href="http://www.mkgmap.org.uk/download/mkgmap.html" rel="noopener" target="_blank">http://www.mkgmap.org.uk/download/mkgmap.html</a>
</div>
</blockquote>
<blockquote type="cite">
<div>
I've tested this with the example file posted before, accept for b18 all cases work as expected.
</div>
</blockquote>
<blockquote type="cite">
<div>
Gerd
</div>
<div>
_______________________________________________
</div>
<div>
mkgmap-dev mailing list
</div>
<div>
<a href="mailto:mkgmap-dev@lists.mkgmap.org.uk">mkgmap-dev@lists.mkgmap.org.uk</a>
</div>
<div>
<a href="http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev" rel="noopener" target="_blank">http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev</a>
</div>
</blockquote>
<div>
_______________________________________________
</div>
<div>
mkgmap-dev mailing list
</div>
<div>
<a href="mailto:mkgmap-dev@lists.mkgmap.org.uk">mkgmap-dev@lists.mkgmap.org.uk</a>
</div>
<div>
<a href="http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev" rel="noopener" target="_blank">http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev</a>
</div>
<div>
_______________________________________________
</div>
<div>
mkgmap-dev mailing list
</div>
<div>
<a href="mailto:mkgmap-dev@lists.mkgmap.org.uk">mkgmap-dev@lists.mkgmap.org.uk</a>
</div>
<div>
<a href="http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev" rel="noopener" target="_blank">http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev</a>
</div>
</blockquote>
</body>
</html>