Hi Nick,
sorry, my example was wrong. Here is the corrected version:
highway=* & bicycle!=* & is_in(landuse,cemetery,all)=true {add bicycle=dismount}
The function returns a value (true or false) which has to be tested.
Gerd
________________________________________
Von: mkgmap-dev <[email protected]> im Auftrag von Pinns
UK <[email protected]>
Gesendet: Donnerstag, 9. Januar 2020 14:50
An: [email protected]
Betreff: Re: [mkgmap-dev] Branch is_in ready for a first test
Hi Gerd
I used the latest http://www.mkgmap.org.uk/download/mkgmap-is-in-r4408.zip
I added
highway=* & bicycle!=* & is_in(landuse,cemetery,all) {add bicycle=dismount}
& get
Error in style: Error: (lines:22): Value 'is_in()[landuse, cemetery,
all]' is not part of an expression
Error in style: Error: (lines:22): Value 'is_in()[landuse, cemetery,
all]' is not part of an expression
Error in style: Error: (lines:22): Value 'is_in()[landuse, cemetery,
all]' is not part of an expression
Am I missing something ?
I'm confused about which option if any is required
If I use
--is-in-hook=landuse
I get an invalid option error
r
Nick
On 09/01/2020 11:43, Gerd Petermann wrote:
> Hi all,
>
> the branch version r4408 implements the style function is_in with three
> parameters tag-key,tag-value,method
> - tag-key can be something like landuse or natural or amenity
> - tag-value would be the expected value for that tag-key
> - method has to be "any" or "all".
>
> Example usage in lines:
> # no cycling within a cemetery
> highway=* & bicycle!=* & is_in(landuse,cemetery,all) {add bicycle=dismount}
>
> 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.
> With the current implementation this index is created for appearance of the
> is_in function in a style rule (subject to optimization)
>
> When the style function is called it retrieves the stored shape(s) which
> intersect the boundary of the element.
> If none is found "false" is returned.
> 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.
> 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.
> 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.
> If method "any" is used and the shape is completey within one hole "false" is
> returned.
> If method "all" is used and the shape is partly within one hole "false" is
> returned.
> If we get here true is "returned"
>
> 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.
> The ResidentialHook is now automatically disabled when the style doesn't use
> mkgmap:residential anywhere.
>
> TODO:
> - various possible special cases need more testing
> - maybe add more methods for cases where parts of the tested element touch
> the boundary of the shape.
> - tuning
> - unit tests
>
> As always with branch version the binary can be found at the bottom of the
> download page.
> http://www.mkgmap.org.uk/download/mkgmap.html
>
> I've tested this with the example file posted before, accept for b18 all
> cases work as expected.
>
> Gerd
> _______________________________________________
> mkgmap-dev mailing list
> [email protected]
> http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
_______________________________________________
mkgmap-dev mailing list
[email protected]
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
_______________________________________________
mkgmap-dev mailing list
[email protected]
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev