Hi Gerd, hi Ticker,
sorry for the delay, until the weekend I didn´t found time to test the new versions.
I´m very impressed, my results now are so precise that I could revert all the gaps I created for the first hook.
Many thanks for all your efforts to realize this accuracy!
Still I´m only on lines inside cemetery/allotments, so I have no clue about the buildings in v4 samples, sorry.
I check for „all“ and for „any“, giving two new values and then reduce them to one if another match, ie:
highway=* & ... & is_in(landuse,allotments,all)=true {add isin=1}
highway=* & ... & is_in(landuse,allotments,any)=true {add isin=2}
highway=* & isin=1 {set highway=path}
highway=* & isin=2 bicyle=no {set highway=path}
That works as I expect: reduce all-in, and any-in only if specified.
I didn´t understood yet : could ON still be a value to ask for, beside IN and OUT?
Or has it become obsolete? In anyway, with my rule above I see no complaint about it.
Only one unclear example so far I found - probably caused by the multipolygon?
The first line is not matched by the any-rule, but the second is. Both should match according to style:
As said, only one. With is_in render time is increased by only 5-10%, pretty cheap.
Thanks to all for the ideas read here how to play with this wonderful new option.
Jan
Hi all,the message "SCHWERWIEGEND (IsInFunction): .\Baustelle\Speiche_Kanaren_Splitter\88002007.osm.pbf: rounding error? first point is on line but status of first point is not ON" was produced for this node:https://www.openstreetmap.org/node/640552250#map=18/28.14036/-16.52529The node is extremely close to the landuse=residential way 255452457. In OSM precision the node is inside the residential area, but in mkgmap precision it is outside.These special cases really cause trouble. To improve performance, the code first tests the result for the first point. If this result is IN and method is 'any' or when result is OUT and method is 'all' there should be no need to test any further nodes or edges, thus the corresponding result is returned.Now, with these special cases the quick result may be wrong.With r4116 I've disabled the quick test. The result is more likely to be correct but performance can be poor when complex areas are involved.For normal cases the difference should be small, maybe a second per tile.Gerd________________________________________Von: mkgmap-dev <mkgmap-dev-bounces@lists.mkgmap.org.uk> im Auftrag von Arndt Röhrig <arndt@speichenkarte.de>Gesendet: Samstag, 11. Januar 2020 12:02An: Development list for mkgmapBetreff: Re: [mkgmap-dev] Branch is_in ready for a first testGood morning,so far i used "mkgmap:residential" to draw some highways thinner in citys. I replaced it with the is_in function and added some other polys like "school", "industrial" etc. It works fine, great.I added also a "bicycle=no" on "cemetarys", "schools", "landfills", "quarry" etc.Thank you all for this work!Problem #1:is_in(landuse,residential,any)=true will not work in "Wuppertal". mkmap:residential also no work there either.I suspect the reason in the osm-data, but i don´t see why. Have anybody an idea?https://fotos.rennrad-news.de/f3/4/494/494184-sm3yb9gt4tjr-test-medium.pngProblem, #2:r-4412 report: SCHWERWIEGEND (IsInFunction): .\Baustelle\Speiche_Kanaren_Splitter\88002007.osm.pbf: rounding error? first point is on line but status of first point is not ONhttps://speichenkarte.de/88002007.osm.pbfgreetingsArndtGerd Petermann < gpetermann_muenchen@hotmail.com<mailto:gpetermann_muenchen@hotmail.com>> hat am 10. Januar 2020 um 12:07 geschrieben:Hi Ticker,thanks, see r4412 : http://www.mkgmap.org.uk/websvn/revision.php?repname=mkgmap&rev=4412Gerd________________________________________Von: mkgmap-dev < mkgmap-dev-bounces@lists.mkgmap.org.uk<mailto:mkgmap-dev-bounces@lists.mkgmap.org.uk>> im Auftrag von Ticker Berkin < rwb-mkgmap@jagit.co.uk<mailto:rwb-mkgmap@jagit.co.uk>>Gesendet: Freitag, 10. Januar 2020 11:29An: Development list for mkgmapBetreff: Re: [mkgmap-dev] Branch is_in ready for a first testHi GerdHere is patch that sets isLineRule in the package on the augmentsWithcall.I've also used default method for the augmentsWith... in Rule, Op,OsmConverter and backed out the changes that have now becomeunnecessary.TickerOn Fri, 2020-01-10 at 09:15 +0000, Gerd Petermann wrote:Hi Ticker,yes, it would probably be better to know if the function is for apolyline or polygon. A patch would be welcomed.And yes, the expected result for the case you describe is not yetclear. See b13 and b14 in my example file.Gerd________________________________________Von: mkgmap-dev < mkgmap-dev-bounces@lists.mkgmap.org.uk<mailto:mkgmap-dev-bounces@lists.mkgmap.org.uk>> im Auftragvon Ticker Berkin < rwb-mkgmap@jagit.co.uk<mailto:rwb-mkgmap@jagit.co.uk>>Gesendet: Freitag, 10. Januar 2020 09:59An: Development list for mkgmapBetreff: Re: [mkgmap-dev] Branch is_in ready for a first testHi GerdI think the logic still needs to know if it is handling a closed wayasa polygon rule or as a line rule.Firstly to be able to correctly handle the case where the rule.wayrunsaround a hole in the target.polygon - all of the rule.line is in thetarget, but only part of the rule.polygon is in the target.Also there might be different method keywords for the two. Forpolygonrules, "any" and "all" are adequate, but for line rules others mightberequired.I've just svn updated the is_in branch. Is there still work to do onnon-closed ways?Otherwise amazing.TickerOn Thu, 2020-01-09 at 11:43 +0000, Gerd Petermann wrote:Hi all,the branch version r4408 implements the style function is_in withthree 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 cemeteryhighway=* & bicycle!=* & is_in(landuse,cemetery,all) {addbicycle=dismount}Before any style rule is evaluated the function evaluates the listofall ways found in the input file. When a way matches the given tag(key+value) and is closed and complete the shape geometry is storedin a spatial index.With the current implementation this index is created forappearanceof 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, sothat overlapping or touching shapes are combined to a single shapewhich may include holes.The list of (outer) shapes is then tested one after the other untilone shape is found which either contains the element completely or-when "any" is used as method - partially. If none is found thevalue"false" is returned.If a match is found and the combined shapes have holes, a finaltestis 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 andtheResidentialHook. The results should be a bit more predictable nowassearches are done with higher precsion. Still, both try to find anearby boundary(shape) if none is found at the exact position.The ResidentialHook is now automatically disabled when the styledoesn't use mkgmap:residential anywhere.TODO:- various possible special cases need more testing- maybe add more methods for cases where parts of the testedelementtouch the boundary of the shape.- tuning- unit testsAs always with branch version the binary can be found at the bottomof the download page.http://www.mkgmap.org.uk/download/mkgmap.htmlI've tested this with the example file posted before, accept forb18all cases work as expected.Gerd_______________________________________________mkgmap-dev mailing listmkgmap-dev@lists.mkgmap.org.uk<mailto:mkgmap-dev@lists.mkgmap.org.uk>http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev_______________________________________________mkgmap-dev mailing listmkgmap-dev@lists.mkgmap.org.uk<mailto:mkgmap-dev@lists.mkgmap.org.uk>http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev_______________________________________________mkgmap-dev mailing listmkgmap-dev@lists.mkgmap.org.uk<mailto:mkgmap-dev@lists.mkgmap.org.uk>http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev_______________________________________________mkgmap-dev mailing listmkgmap-dev@lists.mkgmap.org.ukhttp://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev