logo separator

[mkgmap-dev] is_in() function for point on line

From Joris Bo jorisbo at hotmail.com on Tue Jun 9 09:45:53 BST 2020

<I already sent this one, but did not see it myself coming back or find it on ‘pipermail’, maybe it’s a duplicate now, sorry for the noise then>



Hi



I did some more testing on using the add-pois-to-lines and mkgmap:from-node: and got a little confused.

As far as I understand is the classic implementation of add-pois-to-lines to create a poi for every node on the line.

By checking for example mkgmap:line2poitype = mid you decide to use it or not.

Nice improvement on performance is the mentioned options to not create useless poi's and the idea to do it for start,mid,end,tagged or all



The manual states that all values of the line are copied to the node.

When testing for highway=turning circle it worked even too well as also the node-tags highway = turning_circle was overwritten by the highway = track value of the way it was part of.

Then Gerd started a 'branch' (if that’s the correct word)  with the mkgmap:from-node: feature, and also this worked perfectly



Yesterday I started a new usage: There is a node barrier = gate on a highway = path where the barrier does not have access tags.

In my style the default for barriers without an access tag is to not allow access (why would they otherwise be added) and highways without access tags to do allow access (that’s where highways for)



But as sometimes forgotten by taggers, to finetune access… I'd like to check if the barrier is on a highway with an official bike/hike route as set in the relation file.

In that case I like to add foot = yes or bicycle = yes. Always worked for the highways but because not set on the barrier-node the routing breaks.



I expected to be able to catch the barrier with

Osmid() = 2486838092

            Check, catched but no more tags then barrier = gate



Current implementation r4521

            barrier = gate & highway = track & route = foot {echotags 'all'}

            but that failed (add-pois-to-lines ~ true)





Strange because in the turning_circle situations I even got 2 poi's. One for the node and one for being part of a highway.



My example where routing broke is a barrier = gate somewhere on a highway = track.

In this case only the osm() node seems to be created and not the "add-pois-to-lines node".

On the other hand (strange?) the highway = track does contain the tag:  mkgmap:way-has-pois=true to indicate that the highway has barriers



Finally ...

Gerd launched the idea to create the tag mkgmap:copied-as-poi=true



If there are two pois created "the osm node barrier = gate" and the "add-pois-to-lines node" version,  I only can use the "add-pois-to-line version" because that one gives me access to the line where it was derived from.

But this also means that when processing the "osm node version" it must be ignored only if later on, another one comes along. How do you know?

If a single stand alone barrier comes along, you do like to use it the same way as it is always has be done



Questions 😊

Can I expect to have the barrier = gate nodes always to created twice if attached to a highway and add-pois-to-line = true?

Can I catch it with the future functionality we started for the turning circle as well?

Do we best extend the mkgmap:copied-as-poi=true to be available both from the osm node version of the poi as well as the created poi?



I'm happy do more testing

Hopefully you guys can still handle my stories.



Kind regards, Joris







Test area

Node: https://www.openstreetmap.org/node/2486838092

            (already updated to foot=yes, but not important for the test)

Highway https://www.openstreetmap.org/way/241008394

Walking route: https://www.openstreetmap.org/relation/3251904



[cid:image002.jpg at 01D63E4A.69A98E30]



To be sure it was not a baecamp problem

When only adding mkgmap:foot=yes to the node barrier=gate its oke

[cid:image004.jpg at 01D63E4A.69A98E30]







-----Oorspronkelijk bericht-----

Van: mkgmap-dev <mkgmap-dev-bounces at lists.mkgmap.org.uk<mailto:mkgmap-dev-bounces at lists.mkgmap.org.uk>> Namens Mike Baggaley

Verzonden: dinsdag 9 juni 2020 00:14

Aan: 'Development list for mkgmap' <mkgmap-dev at lists.mkgmap.org.uk<mailto:mkgmap-dev at lists.mkgmap.org.uk>>

Onderwerp: [mkgmap-dev] add-pois-to-lines documentation



Hi Gerd, please find attached a proposed patch to the documentation for the add-pois-to-lines option as requested.



Cheers,

Mike



>I've implemented the suggested improvements with r4507. Please suggest

improvements for the documentation changes.





-----Oorspronkelijk bericht-----
Van: mkgmap-dev <mkgmap-dev-bounces at lists.mkgmap.org.uk> Namens Gerd Petermann
Verzonden: dinsdag 9 juni 2020 10:25
Aan: Development list for mkgmap <mkgmap-dev at lists.mkgmap.org.uk>
Onderwerp: Re: [mkgmap-dev] is_in() function for point on line



Hi all,



forgot to add the download link for the binary:

http://files.mkgmap.org.uk/detail/480



I've now tested that  --add-pois-to-lines=mid,tagged-node tagged-node works as expected, but documentation still needs improvements.

If e.g. --add-pois-to-lines=mid,tagged-node is used the option tagged-node has no effect unless the points style contains a corresponding rules like

mkgmap:from-node:highway = turning_circle & highway = track             [0x641a resolution 24]

is found.

I've implemented it like this to reduce the memory footprint because I thought of those nodes which have unintresting tags like source=*. I forgot that those tags are already removed before POIGeneratorHook is executed. I'll do some more testing now...



Gerd







Gerd



________________________________________

Von: Gerd Petermann <gpetermann_muenchen at hotmail.com<mailto:gpetermann_muenchen at hotmail.com>>

Gesendet: Dienstag, 9. Juni 2020 09:43

An: Development list for mkgmap

Betreff: AW: [mkgmap-dev] is_in() function for point on line



Hi Mike, Hi Joris



while looking at patch addpois-doc.patch I noticed that poi-tagged.patch has a paste+copy error. The new option "tagged" did not work.

Attached is a corrected version which implements tagged-node and changes/adds documentation.



@Mike: Don't know why I used "other" instead of "inner". My bad. We cannot just change the doc, we also have to support the corrected option.



Reg. "creation of POIS from the lines style file" : It might be possible to add new logic which would add a point object while a line is processed. Up to now the order is "relations, points, lines[+polygons], so POIs are processed before lines. If we change that we have to find an alternative for the dead-end-check processing. Problem : That wouldn't allow to remove the existing code, it just adds complexity with the risk of breaking existing installations.

Without the legacy code I would like the idea.



Gerd





________________________________________

Von: mkgmap-dev <mkgmap-dev-bounces at lists.mkgmap.org.uk<mailto:mkgmap-dev-bounces at lists.mkgmap.org.uk>> im Auftrag von Mike Baggaley <mike at tvage.co.uk<mailto:mike at tvage.co.uk>>

Gesendet: Montag, 8. Juni 2020 23:45

An: 'Development list for mkgmap'

Betreff: Re: [mkgmap-dev] is_in() function for point on line



Hi Gerd, I've tried out the --add-pois-to-lines=mid option and it seems to work well, giving me something like a 5% performance improvement. There are a couple of errors in the documentation - it doesn't explain what 'other' does, and there's no option for 'inner' (should 'other' read 'inner' in the option?).  Also it says that the default is to create all possible POI - I assume this is the default if the option is provided with no value and that the default is for no POIs to be added.



You haven't mentioned whether the patch also allows the creation of POIS from the lines style file - I'm assuming it is just the command line.



Thanks for the quick implementation,

Mike



-----Original Message-----

From: Gerd Petermann [mailto:gpetermann_muenchen at hotmail.com]

Sent: 03 June 2020 08:40

To: Mike Baggaley <mike at tvage.co.uk<mailto:mike at tvage.co.uk>>; 'Development list for mkgmap' <mkgmap-dev at lists.mkgmap.org.uk<mailto:mkgmap-dev at lists.mkgmap.org.uk>>

Subject: Re: [mkgmap-dev] is_in() function for point on line



Hi Joris, Hi Mike,



I've implemented the suggested improvements with r4507. Please suggest improvements for the documentation changes.

I did not yet document the new prefix mkgmap:from-node: in the style because I found no simple description. Feel free to suggest something.

Reg. the implementation:

I decided to ignore all tags with the prefix mkgmap: , e,g. those from the LocationHook like mkgmap:admin_level2. It might happen that the values for the node are different to those copied from the way, but I don't assume that anybody wants to add extra rules for that.

Maybe I should change it the other way around so that the generated POI gets the "exact" values from the node (without the mkgmap:from-node: prefix?



The code should also work for POIs added with the --add-pois-to-areas option when the generated POI is using the location of a node because of the --pois-to-areas-placement option.



Gerd



________________________________________

Von: Mike Baggaley <mike at tvage.co.uk<mailto:mike at tvage.co.uk>>

Gesendet: Montag, 1. Juni 2020 12:34

An: 'Gerd Petermann'; 'Development list for mkgmap'

Betreff: RE: [mkgmap-dev] is_in() function for point on line



Hi Gerd,



I have --add-pois-to-lines in my command, but right near the beginning of my points file I have



mkgmap:line2poitype=start | mkgmap:line2poitype=inner | mkgmap:line2poitype=end {deletealltags} # only centre of line wanted



I wonder whether there could be some efficiency improvement by extending the --add-pois-to-lines option to be something like



--add-pois-to-lines[=start|end|inner|mid[,...]]



We would then reduce the number of unwanted POIs created.



I actually only use this for placing bridge and tunnel names at the middle of the way and replacing line gates with point gates, so being able to do this in the lines file of my style sheet would be even better:



tunnel=* | bridge=* | barrier=gate {set mkgmap:addpoistoline=mid}



This assumes that generating POIs happens after the line stylesheet is processed.



Regards,

Mike



-----Original Message-----

From: Gerd Petermann [mailto:gpetermann_muenchen at hotmail.com]

Sent: 01 June 2020 10:50

To: Development list for mkgmap <mkgmap-dev at lists.mkgmap.org.uk<mailto:mkgmap-dev at lists.mkgmap.org.uk>>

Subject: Re: [mkgmap-dev] is_in() function for point on line



Hi Joris,



probably my ideas don't work. Your case is very special because you render the POI only when it is part of a way. The example with entrance=main is probably not a good one as entrance=main & is_in(building,mall,on) [...] already works.

I've coded a better patch so that your example will also work when option --link-pois-to-ways is not used. Up to now the patch depends on that.



I do not yet see how mkgmap can avoid the generation of all useless POI without adding a lot of code to analyse the rules in the points file, but I still think about this. Problem is that we have the generated tags like mkgmap:admin_level10 or mkgmap:residential and I fear to break something that uses tricky rules with just these tags.



> Or we could work the other way around, in stead of render all poi's for all objects and not use them, the mapmaker specifies the explicit objects the poi's are needed.

Yes, might be an option. An exclude list might also work.



Gerd





________________________________________

Von: mkgmap-dev <mkgmap-dev-bounces at lists.mkgmap.org.uk<mailto:mkgmap-dev-bounces at lists.mkgmap.org.uk>> im Auftrag von Joris Bo <jorisbo at hotmail.com<mailto:jorisbo at hotmail.com>>

Gesendet: Montag, 1. Juni 2020 10:51

An: Development list for mkgmap

Betreff: Re: [mkgmap-dev] is_in() function for point on line



Hallo Gerd,



This works perfect ! (points - file)

mkgmap:from-node:highway = turning_circle & highway = track             [0x641a resolution 24]

mkgmap:from-node:highway = turning_circle & highway != track            [0x641b resolution 24]



Your suggestion will indeed also feature your 'entrance=main' example which is actually a very useful one to avoid cluttering The "add-poi-to-lines" option is still usefull I think ?

For example

- to give a bicycle route a name-poi

- render a symbol for the line leisure = slipway

- render a cable car symbol for aerialway = gondola

- a warning symbol at the highway = via_ferrata

- or incline symbols at the start of steep mountain highways?



If those could be solved without rendering thousands of poi's for complex multipolygon lines that would be great of course.

Or we could work the other way around, in stead of render all poi's for all objects and not use them, the mapmaker specifies the explicit objects the poi's are needed.



Kind regards

Joris



-----Oorspronkelijk bericht-----

Van: mkgmap-dev <mkgmap-dev-bounces at lists.mkgmap.org.uk<mailto:mkgmap-dev-bounces at lists.mkgmap.org.uk>> Namens Gerd Petermann

Verzonden: zondag 31 mei 2020 11:38

Aan: Development list for mkgmap <mkgmap-dev at lists.mkgmap.org.uk<mailto:mkgmap-dev at lists.mkgmap.org.uk>>

Onderwerp: Re: [mkgmap-dev] is_in() function for point on line



Hi Joris,



up to now we only mentioned nodes with a highway=* tag used in ways with a highway=* tag.

I've coded a rather simple patch for that, but while I did that I wondered why this should be limited to highways.

I decided to use the prefix "mkgmap:from-node:". Tags with prefix mkgmap:  are not copied.



My understanding is that you want a function which tells you if a tagged node is used in one or more ways with a given tag.

For example, you may want to render a node with entrance=main, but only when it is the entrance to a building=mall.

This will not work, because only nodes with the tags barrier or highway are treated special.



I think it is possible to implement this as well. We probably just have to check the points rules and look for uses of "mkgmap:from-node:".

Maybe this would also allow to get rid of the computational overhead produced by the add-poi-to-lines option. The current implementation of this option is really ugly as it computes lots of points which are never used to generate any map object. Think of a complex natural=wood polygon (no other tags). If the points file doesn't contain a rule for natural=wood there is no need to generate the POIs.



I've uploaded a binary compiled with the attached patch here:

http://files.mkgmap.org.uk/download/473/mkgmap.jar



Gerd





________________________________________

Von: mkgmap-dev <mkgmap-dev-bounces at lists.mkgmap.org.uk<mailto:mkgmap-dev-bounces at lists.mkgmap.org.uk>> im Auftrag von Joris Bo <jorisbo at hotmail.com<mailto:jorisbo at hotmail.com>>

Gesendet: Sonntag, 31. Mai 2020 09:06

An: Development list for mkgmap

Betreff: Re: [mkgmap-dev] is_in() function for point on line



Hi Gerd



Thanks for the answer, always nice if it makes sense again. Then it was worth the testing 😊

For me that would be perfect, the number of cases this will occur is limited so that it's no problem to explicitly test against this replace value. There are probably more situations around highways where this could occur like highway = bus_stop, highway = speedcamera, and traffic signals.



Kind regards,

Joris







-----Oorspronkelijk bericht-----

Van: mkgmap-dev <mkgmap-dev-bounces at lists.mkgmap.org.uk<mailto:mkgmap-dev-bounces at lists.mkgmap.org.uk>> Namens Gerd Petermann

Verzonden: zaterdag 30 mei 2020 18:39

Aan: Development list for mkgmap <mkgmap-dev at lists.mkgmap.org.uk<mailto:mkgmap-dev at lists.mkgmap.org.uk>>

Onderwerp: Re: [mkgmap-dev] is_in() function for point on line



Hi Joris,

yes, it is a special case. The generated POI gets the tags from the way, so highway=turning_circle is replaced by highway=track.

The node 7131748927 appears only with the tag highway=turning_circle (and maybe the address tags)



Not sure what to do. Maybe store the replaced tag(s) with a prefix, e.g. mkgmap:replaced:highway=turning_circle in this case?



Gerd



________________________________________

Von: mkgmap-dev <mkgmap-dev-bounces at lists.mkgmap.org.uk<mailto:mkgmap-dev-bounces at lists.mkgmap.org.uk>> im Auftrag von Joris Bo <jorisbo at hotmail.com<mailto:jorisbo at hotmail.com>>

Gesendet: Samstag, 30. Mai 2020 18:11

An: Development list for mkgmap

Betreff: Re: [mkgmap-dev] is_in() function for point on line



Hi Gerd



Could it be possible that in this case the highway tag of the line is ignored because the point turning_circle is of type highway as well?



It's like there is a point {highway = turning_circle} on a line {highway =  track} It looks like I cannot catch it with the mkgmap:line2poitype and mkgmap:line2poi.



Somewhere else I already use

leisure = slipway & mkgmap:area2poi != true & mkgmap:line2poitype = mid  and that works fine



Kind regards,

Joris





-----Oorspronkelijk bericht-----

Van: mkgmap-dev <mkgmap-dev-bounces at lists.mkgmap.org.uk<mailto:mkgmap-dev-bounces at lists.mkgmap.org.uk>> Namens Gerd Petermann

Verzonden: zaterdag 30 mei 2020 17:51

Aan: Development list for mkgmap <mkgmap-dev at lists.mkgmap.org.uk<mailto:mkgmap-dev at lists.mkgmap.org.uk>>

Onderwerp: Re: [mkgmap-dev] is_in() function for point on line



Hi Joris,



is_in() only works with polygons. You can use --add-pois-to-lines, but be aware that it produces a lot of points for which you probablly don't want to add an object to the map. See the help for the details.



Gerd



________________________________________

Von: mkgmap-dev <mkgmap-dev-bounces at lists.mkgmap.org.uk<mailto:mkgmap-dev-bounces at lists.mkgmap.org.uk>> im Auftrag von Joris Bo <jorisbo at hotmail.com<mailto:jorisbo at hotmail.com>>

Gesendet: Samstag, 30. Mai 2020 17:40

An: Development list for mkgmap

Betreff: [mkgmap-dev] is_in() function for point on line



Hi



Does the is_in() function should also work for a point on a line in stead of in a polygon?



highway = turning_circle & is_in(highway, track, in_or_on) = true      [0x641a resolution 24]



It returns false for this situation where the turningcircle is attached to a highway = track.

(mkgmap:cache_is_in_POINT_highway_track_in_or_on=false)



Would there be another way to know if the point is attached to a highway = track rather then a for example highway = residential?

I use add-pois-to-lines, and link-pois-to-ways but as far as I can see, that doesn't give me more information.



https://www.openstreetmap.org/#map=18/49.65888/5.45845

[cid:image002.jpg at 01D636A9.5643B8A0]





Kind regards

Joris



_______________________________________________

mkgmap-dev mailing list

mkgmap-dev at lists.mkgmap.org.uk<mailto:mkgmap-dev at lists.mkgmap.org.uk>

http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev

_______________________________________________

mkgmap-dev mailing list

mkgmap-dev at lists.mkgmap.org.uk<mailto:mkgmap-dev at lists.mkgmap.org.uk>

http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev

_______________________________________________

mkgmap-dev mailing list

mkgmap-dev at lists.mkgmap.org.uk<mailto:mkgmap-dev at lists.mkgmap.org.uk>

http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev

_______________________________________________

mkgmap-dev mailing list

mkgmap-dev at lists.mkgmap.org.uk<mailto:mkgmap-dev at lists.mkgmap.org.uk>

http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev





_______________________________________________

mkgmap-dev mailing list

mkgmap-dev at lists.mkgmap.org.uk<mailto:mkgmap-dev at lists.mkgmap.org.uk>

http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev

_______________________________________________

mkgmap-dev mailing list

mkgmap-dev at lists.mkgmap.org.uk<mailto:mkgmap-dev at lists.mkgmap.org.uk>

http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.mkgmap.org.uk/pipermail/mkgmap-dev/attachments/20200609/d8ec1019/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image002.jpg
Type: image/jpeg
Size: 112172 bytes
Desc: image002.jpg
URL: <http://www.mkgmap.org.uk/pipermail/mkgmap-dev/attachments/20200609/d8ec1019/attachment-0002.jpg>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image004.jpg
Type: image/jpeg
Size: 46594 bytes
Desc: image004.jpg
URL: <http://www.mkgmap.org.uk/pipermail/mkgmap-dev/attachments/20200609/d8ec1019/attachment-0003.jpg>


More information about the mkgmap-dev mailing list