Opened 9 years ago

Closed 5 years ago

#2991 closed defect (duplicate)

[roads] Improve rendering of street names

Reported by: stanton Owned by: mapnik-team@…
Priority: minor Milestone:
Component: mapnik Version:
Keywords: Cc:

Description

Mapnik currently seems to render street names once in the middle of each piece of way, with various undesirable effects such as

  • names not rendering at all if the road is split up in multiple short ways (which may happen for multiple reasons, such as different relation memberships or attributes applying just to one part of the way, such as speed limits)
  • names wrapping around angles at strange places when there is enough space to render the name in a straight line
  • names of very long roads appearing just once, making it unclear where the boundary between two differently named sections of the same road (if any) is
  • the name rendering twice if the road is made up of two separate ways which blend into each other when rendering

This could be remedied by the following:

  • Merge all pieces of road if they have the same name and highway attributes and are either joined (i.e. share a common node) or blend into each other (zoom level dependent); render the name for the entire length of the combined road
  • If the resulting road is very long, repeat the names along its length multiple times:
    • at each end and
    • optionally in between where other roads cross, to make it clear the road continues beyond the junction
  • Where possible, pick an almost straight section (defined by minimum angle at a single point and/or minimum curve radius for consecutive points) and render the name there. Failing that, consider splitting the name string up at spaces, hyphens etc. (i.e. by the same rules that apply for line breaks) and find a straight section for each piece of the name. If that doesn't help, "massage" the straightness criteria for that road until a solution is found.

Change History (4)

comment:1 Changed 9 years ago by Ldp

The stylesheet usually repeats names on long roads, but your other points are mostly true. It's a mix of past stylesheet decisions and mapnik behaviour. Some of your points should be addressed within mapnik (the rendered) and some may be addressed by the stylesheet. And some others are much harder to solve cleanly.

Merging roads at render time carries a processing penalty, and due to the way the map is tiled, may introduced other subtle render issues at metatile boundaries. We'll only know about those when we trigger them.

At render time, no road knows anything else about roads closeby, let alone about junctions. Label placement does not take this into account, and is only working in a 'collision avoidance' mode.

Mapnik has a minimum_angle option for texts, but in some cases, that could drop a currently rendering label altogether (short road, sharp angle).

comment:2 Changed 9 years ago by stanton

Well, the most painful issue of the ones I mentioned is clearly the one about street names not rendering if the way is made up of multiple segments. I'd suggest looking into the regressions (processing penalty and potential rendering issues) and see which of the two issues is the more painful one.

comment:3 Changed 5 years ago by math1985

Summary: Improve rendering of street names[roads] Improve rendering of street names

comment:4 Changed 5 years ago by math1985

Resolution: duplicate
Status: newclosed

This issue is now being discussed on Github: https://github.com/gravitystorm/openstreetmap-carto/issues/497 I will therefore close the issue here.

Note: See TracTickets for help on using tickets.