Text/ShieldSymbolizer + line placement often results in clipped/cut off shields/labels #547

Closed
artemp opened this Issue Oct 11, 2011 · 12 comments

Projects

None yet

4 participants

@artemp
Member
artemp commented Oct 11, 2011

This question comes up frequently on mailing lists and IRC: "How can I get mapnik not to cutoff my highway shields?"

The problem is that the placement_finder algorithm only takes into account the envelope of the shield text when considering if the placement is valid if avoid edges is turned on. Thus you may have a chopped off symbol at the edge of a tile.

When metatiles are used with Map.buffer_size > 0, and particularly with line placement, things go goofy: part of a shield is rendered in the buffer, but on the next metatile over, that shield isn't often rendered in that same location.

In the attached patch works. I've addressed this by adding a '''minimum_padding''' property to the TextSymbolizer, which prevents a label (or shield) from being placed too near the edge of the map. If the placement under consideration would put the text envelope + padding are not contained by the map extent, the label will not be placed at that location.

Margin might be a better term than padding for consistency with CSS. This could also be min-padding-x and min-padding-y, but as buffer_size is consistent on all sides and shields are usually squarish in size, I didn't go crazy with expanding all the options.

@artemp
Member
artemp commented Oct 11, 2011

[nino] Note that this patch also works well for a TextSymbolizer with line placement.

@artemp
Member
artemp commented Oct 11, 2011

[springmeyer] thx Nino! this was applied in r2300.

@artemp artemp closed this Oct 11, 2011
@artemp artemp added a commit that referenced this issue Oct 11, 2011
@artemp artemp + apply Nino Walker's patch text_minimum_padding.diff #547
  TODO:  consider simplifying text symbolizer options
0823b83
@Andrey-VI

@artemp, @herm
It seems that the issue returned in recent revisions (no more than 10 days ago, I'm not able to check now) of Mapnik2:
http://s1141.photobucket.com/albums/n595/Andrey_VI/Mapnik2%20labels%20issue/
New images with red lines and more dark water colour. Red lines are specially added metatiles borders. Rendered with 926404d.

@herm herm reopened this Mar 16, 2012
@springmeyer
Member

it may be related to #1116

@Andrey-VI

FYI: Shields are affected too.

@herm herm was assigned Mar 23, 2012
@springmeyer
Member

pushing to 2.1 milestone (off of 2.0.0)

@springmeyer
Member

I think this issue returning has to do with either clipping or #1283, or both. I do not think it is appropriate to re-open this specific issue because this one originally dealt with a way to solve it. So, closing, please follow either #1283, #1281, or #1282 as I think they will address your concerns more specifically.

@springmeyer springmeyer closed this Jul 3, 2012
@springmeyer
Member

@Andrey-VI - just to clarify here: are you using the minimum-padding setting?

@Andrey-VI

No, we didn't use it at all.

@springmeyer
Member

@Andrey-VI - and also not using avoid-edges?

@Andrey-VI

I tried this setting, but with no effect. So I removed it from the style.

@springmeyer
Member

k, thx. it is broken (avoid-edges) in master (for last month) but I am about to fix (#1283 and #1287)

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