Opened 11 years ago

Closed 10 years ago

#937 closed enhancement (fixed)

Increase character limit for shields

Reported by: craigermcgreger@… Owned by: steve8@…
Priority: minor Milestone:
Component: mapnik Version:
Keywords: Cc:

Description

For a number of months, I have been trying to figure out why, for seemingly no reason, shields are not rendered in Mapnik for certain highways, even though they render correctly for surrounding highways.

I have been playing around to see if it was a tag or a combination of tag values that was causing this behavior, to no avail.

At one point, I thought it might be that a shield would not render if the "ref" tag was more than five characters long, but I no longer believe this.

The following are just several examples that I have found of highways that I think should be getting shields but are not:

Change History (11)

comment:1 Changed 11 years ago by Tom Hughes

There is certainly a length limit as I have only rendered the shield images up to a certain width. I'd have to check the source to see what that limt is though.

comment:2 Changed 11 years ago by Tom Hughes

The current limit is 4 for motorways and 5 for everything else. The worst case in your examples seems to be a trunk with an 8 character reference?

My only concern (other than all the duplication in the stylesheet) is that the shields are going to start getting pretty big if we allow that many characters...

comment:3 in reply to:  2 Changed 11 years ago by craigermcgreger@…

Replying to tom@compton.nu:

The current limit is 4 for motorways and 5 for everything else.

Ahh, that explains a lot. This has been driving me crazy for a long time...I should have come here sooner. :)

My only concern (other than all the duplication in the stylesheet) is that the shields are going to start getting pretty big if we allow that many characters...

Sorry, I am not familiar with the stylesheet.

As for the limit: in cases like this, I am not a fan of arbitrary limits. Who is to say what is too long? One person's legitimate need for a, say, 14-character shield may be another person's "too long". I would prefer that there were no limits, and shields that are perceived as being too long be addressed on a case-by-case basis.

If there has to be a limit, however, 16 characters seems to be a good place to start. As you can see from the above, I have a legitimate need for 8-character shields; there is a possibility of longer shields, as we have some four-digit routes that must fit on to shields, spaces and all.

comment:4 Changed 11 years ago by Tom Hughes

Because the shields are fixed bitmaps we have to pregenerate each one in varying widths to allow for the different sizes of reference that we may need to fit on them. That then means that we need to duplicate the logic for rendering shields for each length so that it can choose the right bitmap to render under the text.

That's why I'm not keen on adding more widths than are strictly needed...

Hopefully at some point mapnik will support the use of vector images that can be resized as required to fit the text.

comment:5 in reply to:  4 Changed 11 years ago by craigermcgreger@…

Replying to tom@compton.nu:

Because the shields are fixed bitmaps we have to pregenerate each one in varying widths to allow for the different sizes of reference that we may need to fit on them. That then means that we need to duplicate the logic for rendering shields for each length so that it can choose the right bitmap to render under the text. That's why I'm not keen on adding more widths than are strictly needed...

Ahh, I was not aware that the shields were generated in this manner. That definitely precludes unlimited shield length!

However, while I understand and sympathize with the current situation, four and five characters is just too few for most of my shields. While I suggested 16 characters earlier, six would be a good start, and eight would make my day. For that matter, simply removing the four-character limit for motorways and letting them use five would go a long way.

Thanks for your help.

comment:6 Changed 11 years ago by craigermcgreger@…

Summary: Shields not rendering for certain highwaysIncrease character limit for shields
Type: defectenhancement

comment:7 Changed 11 years ago by tomhughes

Resolution: fixed
Status: newclosed

(In [8007]) Support shields up to 6 characters for motorways and 8 characters for other road types. Closes #937.

comment:8 Changed 11 years ago by chriscf

Resolution: fixed
Status: closedreopened

Re-opening. We have some strays in the UK for which this isn't rendering. They include little things such as "A404(M)", and more major entities such as "M6 Toll" (which properly includes a space". I believe that the only eight-character refs we have had were "A6127(M)" and "A6144(M)", of which the former has been renumbered and the latter downgraded, however, it remains possible that another four-digit A-road is upgraded in future, or a two-digit motorway by-passed with a toll road, so eight characters needs to be supported on motorways too.

comment:10 Changed 10 years ago by Tom Hughes

Owner: changed from Tom Hughes to steve8@…
Status: reopenednew

comment:11 Changed 10 years ago by steve8@…

Resolution: fixed
Status: newclosed

Now all resolved

Note: See TracTickets for help on using tickets.