Skip to content

Street names rendering improvements #644

Closed

Description

@pbmorton

Using mapsforge 0.5.1 sample App. If you change one rule in rendertheme-v4.xml to the following (the only change in this rule is zoom-min=15 changed to zoom-min=13):

<rule e="way" k="highway" v="secondary_link|primary_link|trunk_link|motorway_link|secondary|primary" zoom-min="13">
<pathText k="name" display="always" priority="-6" font-style="bold" font-size="12" fill="#000000" stroke="#FFFFFF" stroke-width="2.0"/>
</rule>

You should see highway names on the map at zoom 13 and 14. But they do not appear until zoom=15, even though the highways are visible at zooms 13 and 14.

Activity

  1. devemux86 commented on Jul 6, 2015

    @devemux86
    Collaborator

    Line labels are a special case.
    Besides all common placement rules they obey, internally each label needs to "fit" in the line segment it's supposed to appear.

  2. pbmorton commented on Jul 7, 2015

    @pbmorton
    Author

    Thanks. From your response it seems this is expected behaviour. I think you should consider changing this behaviour in future. At zoom=13 (for example) a map may only show major highways and it would be useful to display the names of the highways. Forcing a user to zoom in to get the names to appear, then zoom out again to use the map, is not user friendly in my opinion. It is inconsistent too as other features like rivers display names at zoom=13. What do you think about changing this in future?

  3. devemux86 commented on Jul 7, 2015

    @devemux86
    Collaborator

    I agree that this is not the best behavior and we should review it (though I don't know if it's technically possible).

  4. devemux86 commented on Jul 7, 2015

    @devemux86
    Collaborator

    BTW have you played with render theme directives, like priority and display?

  5. pbmorton commented on Jul 7, 2015

    @pbmorton
    Author

    I did play around with the display and priority directives but could not make the labels visible.

  6. eartrumpet commented on Jul 14, 2015

    @eartrumpet

    The only way to make highway names visible at lower zoom levels (sometimes, if the highway has short segments and a long name, this means ZL 16-18!) is to use caption instead of pathText - with other annoyances involved.

    This is one of the last major disadvantages of mapsforge which regularly creates support questions.

    Can this be fixed with the label layer? OSMAnd for example has pathTexts winding along the highway, which would be desireable too.

  7. devemux86 commented on Jul 14, 2015

    @devemux86
    Collaborator

    Can this be fixed with the label layer?

    Have you tried it?

  8. eartrumpet commented on Jul 14, 2015

    @eartrumpet

    At the moment it makes no difference, and it seems to me that pathText is still rendered on the map layer.

    Right now pathText is rendered on every possible segment, if you zoom in far enough, which isn't desireable as well (especially with possible solution like truncating or just writing the name longer than the segment) .
    Also only once per tile if it's a long straight segment which passes several tiles (for example on aerial ways).

    Could moving to label layer it might be possible to limit it to once per name value? Then it might make sense to just write the whole name, even if it's longer than a segment.

    Edit: Maybe it makes sense to have pathText once per tile, as for longer routes/roads. So showing the name value without limiting it to the segment length only once per tile may be a good compromise.

  9. Klaus-Tockloth commented on Feb 8, 2016

    @Klaus-Tockloth

    emux already referenced it ... so only to keep the context ... here's the relevant screenshot (which shows a lot of missing street labels).

    bildschirmfoto 2016-02-07 um 20 18 09

    It seems that the rules for supressing the street labels are to strict. IMHO it's important to increase the number of labels shown, even if they are not rendered perfectly (or have some glitches).

    Klaus

  10. changed the title [-]mapsforge highway names disappear at lower zoom levels[/-] [+]Not all street labels are shown on the map[/+] on Feb 8, 2016
  11. ludwigb commented on Feb 14, 2016

    @ludwigb
    Collaborator

    I changed the algorithm a bit:

    • moving street names into the middle of a segment
    • reduce margins where I think they were overly cautions or even double calculated
    • reduce margin value

    Overall we get more street names with a more pleasing layout.

  12. devemux86 commented on Feb 14, 2016

    @devemux86
    Collaborator

    +1

    Are we certain the labels are in segments center? (they seem a bit off)

    Also the skipPixels - specially now with arbitrary value - what's exactly its purpose?

  13. ludwigb commented on Feb 14, 2016

    @ludwigb
    Collaborator

    skipPixels is used to avoid repeating the street name all the time if there
    is space. Previously it was dependent on the name length, which to me does
    not make much sense.

    actually, just double checking: the calculations might be total rubbish,
    will have to check tomorrow or so again. But at least we do not have them
    stuck at the beginning of the road anymore.

    Thanks for checking....

    On 14 February 2016 at 21:35, Emux [email protected] wrote:

    +1

    Are we certain the labels are in segments center, they seem a little off.

    Also the skipPixels - specially now with arbitrary value - what's exactly
    its purpose?

    —
    Reply to this email directly or view it on GitHub
    #644 (comment)
    .

  14. devemux86 commented on Feb 14, 2016

    @devemux86
    Collaborator

    Another thought is whether we need to make skipPixels dependent on display model scale factor now.

  15. ludwigb commented on Feb 14, 2016

    @ludwigb
    Collaborator

    possibly, I was wondering what unit that actually is.

    On 14 February 2016 at 22:06, Emux [email protected] wrote:

    Another thought is if we need to make skipPixels dependent on display
    model scale factor now.

    —
    Reply to this email directly or view it on GitHub
    #644 (comment)
    .

  16. lincomatic commented on Apr 22, 2016

    @lincomatic
    Contributor

    This new code shows more streets, which is great, but at the same time, there are more duplicate names on the same street.

    Old code:
    image

    New code:
    image

  17. ludwigb commented on Apr 22, 2016

    @ludwigb
    Collaborator

    yes, that is what the code does: it relaxes the space restrictions for
    street names a bit, so sections that were not considered long enough now
    sometimes display a street name

    On 23 April 2016 at 07:21, lincomatic [email protected] wrote:

    This new code shows more streets, which is great, but at the same time,
    there are more duplicate names on the same street.

    Old code:
    [image: image]
    https://cloud.githubusercontent.com/assets/1422186/14757227/fd179e70-08a5-11e6-89cb-aed72de61741.png

    New code:
    [image: image]
    https://cloud.githubusercontent.com/assets/1422186/14757240/2acfadb2-08a6-11e6-85b0-b4b23fe50a3a.png

    —
    You are receiving this because you commented.
    Reply to this email directly or view it on GitHub
    #644 (comment)

  18. lincomatic commented on Apr 26, 2016

    @lincomatic
    Contributor

    I fixed a bug in c8f705f . The street names were not centered. Compare the screen shot below with the one above:
    image

    In WayDecorator.java, the line:

    LineSegment actuallyUsedSegment = drawableSegment.subSegment(offset, wayNameWidth - WAYNAME_SAFETY_MARGIN * 2);

    should be:

    LineSegment actuallyUsedSegment = drawableSegment.subSegment(offset+WAYNAME_SAFETY_MARGIN, wayNameWidth - WAYNAME_SAFETY_MARGIN * 2);

  19. lincomatic commented on Apr 26, 2016

    @lincomatic
    Contributor

    Sorry, my previous comment was referencing lines in stale code. I submitted a PR with the latest dev code #829

  20. changed the title [-]Not all street labels are shown on the map[/-] [+]Street names rendering improvements[/+] on Apr 26, 2016
  21. added this to the 0.6.1 milestone on May 15, 2016
  22. devemux86 commented on May 15, 2016

    @devemux86
    Collaborator

    Closing this part of improvements. Additional can be monitored in new issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions