[Tilesathome] Avoiding name duplications on dual carriageways
Frederik Ramm
frederik at remote.org
Tue Aug 19 22:17:32 BST 2008
Hi,
I have an improvement for or/p that I presented to you a while ago
and then forgot about it ;-) it is meant to reduce the number of text
duplications (name and ref tags) on dual carriageways and similar
situations.
What it does is this:
If a text rule in the style file is flagged "avoid-duplicates=yes", then
whenever this rule leads to a text being drawn, the first and last node
of the corresponding way and the text are stored in memory. Before a
text is drawn for another way, the list is checked to see whether the
same text has already been written to a way whose start and end nodes
are close to the start and end nodes of the way being looked at.
(The distance between the two nodes that will trigger dropping of labels
is currently a hard-coded number in metres, should probably be
configurable per zoom level, e.g. "avoid-duplicates=1000" or so?)
This is quite effective at removing double labels, while at the same
time not doing full text collision avoidance (i.e. if you have two roads
with *different* names next to each other, both names will be drawn no
matter what). The drawback is that results may look arbitrary; whichever
label gets drawn first, gets drawn first (and blocks out another label
in a similar position). Although I have not observed this during my
tests, it is conceivable that a "ref" label along a motorway that sits
exactly on the line between two z12 tiles would be drawn for one lane
on one tile and for the other lane on the other.
Osmarender/XSLT compatibility: Any software not interpreting the
"avoid-duplicates" tag will simply draw *all* labels as before, so again
if you are on the border of two z12 tiles and one is rendered with
Osmarender/XSLT and the other with or/p, it might happen that the XSLT
tile has both names and one of them simply stops at the tile boundary.
This is probably the only adverse effect.
What do people think - should this be used for tiles at home, would it make
the maps better on the whole, or do the drawbacks outweigh the
advantages? - Since the method has to be activated for each text rule we
could start using it only for names/refs on motorways and trunk roads
(which are most likely to be dual carriageways) and see how it works
Bobkare, do you have any plans for doing something similar in the XSLT
version (in which case I might shelve this plan and copy your's for the
sake of compatibility)?
Bye
Frederik
--
Frederik Ramm ## eMail frederik at remote.org ## N49°00'09" E008°23'33"
More information about the Tilesathome
mailing list