[OSM-talk] Patch to render names from routes and custom highway shields on a per country basis
Richard Weait
richard at weait.com
Sun Sep 20 23:20:33 BST 2009
On Tue, Sep 15, 2009 at 10:04 PM, John Smith <deltafoxtrot256 at gmail.com> wrote:
> While my patch works, I don't know if this is the best solution to the
> problem or not:
>
> http://trac.openstreetmap.org/attachment/ticket/1666/osm.xml-patch
I have a similar local hack and decided not to pursue it. In North
America this approach adds thousands of paragraphs to
osm-template.xml, each paragraph more error prone than the previous.
I'd rather see ShieldSymbolizer able to build an icon filename from
key/value data.
At a minimum this is an improvement in the default osm-template.xml as
we currently have eight paragraphs for the default motorway shield:
<Rule>
<Filter>[highway] = 'motorway' and [length] = 8</Filter>
<MaxScaleDenominator>1000000</MaxScaleDenominator>
<MinScaleDenominator>100</MinScaleDenominator>
<ShieldSymbolizer name="ref" face_name="DejaVu Sans Bold"
size="10" fill="#fff" placement="line" file=
"%SYMBOLS_DIR%/mot_shield7.png" type="png" width="59" height="17"
min_distance="30" spacing="750"/>
</Rule>
Eight different paragraphs that vary by ref-length. Just for the
default motorway shield. Note that this paragraph appears to have an
error as [length] = 8 and file uses mot_shield7.png. I pulled this
from svn some time ago so it may have been patched.
Much better, would be to allow something like
file= "%SYMBOLS_DIR%/mot_shield[length].png"
and reduce the default motorway shield to a single paragraph.
More to the point for this thread, this can be extended for localized
shields as something like:
<Rule>
<Filter>[network] != ''</Filter>
<MaxScaleDenominator>1000000</MaxScaleDenominator>
<MinScaleDenominator>100</MinScaleDenominator>
<ShieldSymbolizer name="ref" face_name="DejaVu Sans Bold"
size="10" fill="#fff" placement="line" file=
"%SYMBOLS_DIR%/[network][length].png" type="png" min_distance="30"
spacing="750"/>
</Rule>
Superficially this is a complete solution. All shields selected and
rendered in one paragraph. But there are things to be solved still.
Selecting a shield is analogous to setting a background color, so font
color will change from shield to shield. This needs to be solved.
I've removed the height and width parameters as shield will vary in
size. Does this cause problems later?
This also generalizes away from the non-England problem. In England,
highway tags correspond with posted signs. In USA and Canada they do
not. State routes often make sense meet motorway, trunk, primary and
sometimes secondary standards. The individual paragraph approach
worked for England but it doesn't scale for the World.
In earlier discussions with Paul (cc:'d) we talked about using the
network key to distinguish road networks that use shields[1]. We had
agreed on using a ":" separator like "US:I" but I'm arguing against
that now. First we are not separating equal items, we're adding
specificity to one selector. Second, we're planning to use the
network values in filenames, we should choose characters that won't
lead to problems in on OS or another when used as a file name. Third
OSM key:values have been lower case other than Proper (Street) Names.
So I suggest we pattern on network=us_i for Interstates, us_us for US
Routes, us_ny_ny for New York State Routes, us_ny_ny_co for New York
county roads, etc. These tags should sort nicely alphabetically for
bug-squashing and allow collision avoidance with imperfect knowledge
of other international network naming systems.
I've submitted a ticket with Mapnik requesting an extension to
ShieldSymbolizer to support this proposal. Project lead is currently
on vacation, so let's not swamp him with more requests. ;-)
https://trac.mapnik.org/ticket/352
Best regards,
Richard
[1] http://wiki.openstreetmap.org/wiki/Interstate_Highways_Relations
More information about the talk
mailing list